필터 지우기
필터 지우기

do i have to learn java in order to use java packages in my MATLAB code?

조회 수: 1 (최근 30일)
Rahul Kashyap
Rahul Kashyap 2012년 7월 30일
i'm doing this project in which i'll be moving my mouse using my webcam. so the code has imported some java packages. i have no experiance in java. how can i understand the code. and to write more codes like this, do i have to learn java or i can simply use MATLAB? below is my code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
import java.awt.Robot;
import java.awt.event.*;
mouse = Robot;
vid = videoinput('winvideo', 1);
preview(vid);
for f=1:1000
d=getsnapshot(vid);
d = imresize(d,[480 640]);
i=im2bw(d,.56);
[label num]=bwlabel(i,8);
stats = regionprops(label,'all');
ind= find([stats.Area] < 8000 );
if (num==1)
xx=stats(ind).Centroid(1);
xx=(1366-(xx*2.14));
xx
yy=stats(ind).Centroid(2);
yy=yy*1.6;
yy
mouse.mouseMove(xx, yy);
elseif(num>1)
mouse.mousePress(InputEvent.BUTTON1_MASK);
mouse.mouseRelease(InputEvent.BUTTON1_MASK);
mouse.mousePress(InputEvent.BUTTON1_MASK);
mouse.mouseRelease(InputEvent.BUTTON1_MASK);
end
pause(.001);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
i need to understand this code ASAP

답변 (0개)

카테고리

Help CenterFile Exchange에서 Java Client Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by