canot convert image to movie frame using 'im2frame'

4 Ansichten (letzte 30 Tage)
Fitroh Amaluddin
Fitroh Amaluddin am 13 Okt. 2014
Beantwortet: Image Analyst am 13 Okt. 2014
here the code :
//
vObj = vision.VideoFileReader(car_video.avi);
while ~isDone(vObj)
v = step(vObj);
if (v > threshold)
a=a+1;
imshow (v);
f(a) = im2frame(v);
end
end
movie(f,10);
//
and i get error message like this 'Error using im2frame Can only make movie frames from image matrices of type double or uint8'

Antworten (2)

Geoff Hayes
Geoff Hayes am 13 Okt. 2014
Fitroh - according to the documentation at vision.VideoFileReader and step, the output of the step function is a frame, so the im2frame function should be unnecessary. Verify the class type of v by putting a breakpoint at the line
f(a) = im2frame(v);
and then run the program. When the debugger pauses at this line, type the following in the Command Window
class(v)
Based on the output of this call, if the class type is struct then it is (probably) a frame with the fields cdata and colormap. If that is the case, then you can replace your above line with just
f(a) = v;
Try the above and see what happens!

Image Analyst
Image Analyst am 13 Okt. 2014
What is f? Is it a struct? It must be to use get frame() output. See attached demo.

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by