canot convert image to movie frame using 'im2frame'
2 次查看(过去 30 天)
显示 更早的评论
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'
0 个评论
回答(2 个)
Geoff Hayes
2014-10-13
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!
0 个评论
Image Analyst
2014-10-13
What is f? Is it a struct? It must be to use get frame() output. See attached demo.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!