Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
Rahul Kashyap
Rahul Kashyap le 30 Juil 2012
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

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by