impoly crop frames from a webcam
1 次查看(过去 30 天)
显示 更早的评论
I am getting an error when I try to crop a polygon area from a webcam video (which only shows the cropped polygon from the frame)
vid=videoinput('macvideo',1,'YCbCr422_1280x720');
set(vid,'FramesPerTrigger',Inf);
set(vid,'ReturnedColorspace','rgb');
vid.FrameGrabInterval=5;
start(vid);
data=getsnapshot(vid);
imshow(data);
h = impoly();
position = wait(h);
BW = createMask(h);
while(vid.FramesAcquired<=100)
data=getsnapshot(vid);
data(~BW) = 255;
imshow(data);
end
stop(vid);
flushdata(vid);
clear all;
When I run this script, I see a snapshot of my webcam where I can draw a polygon on it. But that is it. When I close the image after setting a polygon, it gives me an error
Invalid or deleted object.
Error in imroi/parseInputsForCreateMask (line
90)
h_ax = ancestor(obj.h_group,'axes');
Error in imroi/createMask (line 258)
[obj,h_im] =
parseInputsForCreateMask(varargin{:});
Error in camshift2 (line 11)
BW = createMask(h);
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!