Borrar filtros
Borrar filtros

impoly crop frames from a webcam

1 visualización (últimos 30 días)
SANG GYU LEE
SANG GYU LEE el 30 de En. de 2019
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);

Respuestas (0)

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by