Info
此问题已关闭。 请重新打开它进行编辑或回答。
Mouse Pointer in front of the webcam project - code error
1 次查看(过去 30 天)
显示 更早的评论
??? Undefined function or method 'Mouse' for input arguments of type 'char'.
this is the error when I try to run this code, pls help!!!
Code for recognising my hand on the webcam to move the mouse pointer:
vid = videoinput('winvideo',2,'rgb24_320x240'); %preview(vid) % background template bgrnd=getsnapshot(vid); final_bg_template = rgb2gray(bgrnd); cx=100; cy=100; while(1) % extraction of hand frgrnd=getsnapshot(vid); final_frgrnd=rgb2gray(frgrnd); img_subtracted=final_frgrnd-final_bg_template; % binary image of hand % imview(img_subtracted); [m n]=size(img_subtracted); for i=1:m for j=1:n % [EDITED, Jan Simon]: Was "j-1:n" if(img_subtracted(i,j)<25) img_subtracted_bin(i,j)=0; else img_subtracted_bin(i,j)=1; end end end [m n]=size(img_subtracted_bin); % xy coordinates of topmost point for p=m:-1:1 for q=n:-1:1 if(img_subtracted_bin(p,q)==1) x_top=q; y_top=p; end end end cy=x_top; cx=y_top; % [cx cy] = centroid(img_subtracted_bin); set (0,'PointerLocation',[cx*4 cy*3.33]); imshow(img_subtracted_bin); end
2 个评论
Walter Roberson
2012-1-24
Duplicate is at http://www.mathworks.com/matlabcentral/answers/25477-mouse-pointer-in-front-of-the-webcam-project-code-error
Walter Roberson
2012-1-24
http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup
回答(1 个)
Walter Roberson
2012-1-24
There is no reference to Mouse in the code you show. Please show the traceback from the place the message is encountered back to the code you posted.
Better yet would be to merge the above code and the traceback in to your previous question.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!