I am on a problem. My problem is that I want to split all image frames from an avi video. First of all I used aviread() function it gives me the out of memory error. Then from online help I were using mmreader() and read() function to split image frames, but the problem is read images from read() function could not be showed with imshow() function. I have the following code snippet,
function test()
A='G:\ims\avi\nh.avi';
B=mmreader(A);
ims=read(B,[2000 2200]);
figure(1),imshow(ims(1));
end
I hoped this code would show the first image frame but it does not. In this code I am free of out of memory error because I only read 200 frames. But the problem still remains when I try to read all the frames. So mainly I have the following two problems,
- how can I get rid of out of memory problem using mmreader() and read() ?
- why not imshow() above does not show the image frame?
To get rid of the out of memory error consider reading in a single frame inside of a loop as shown in the mmreader documentation (
doc mmreader):The reason
imshowis not working is that the value returned byread(...)is Height x Width x Colors x NumFrames Where Height is the height of the video, Width is the width of the video, Colors is the number of colors (usually 3) and NumFrames is the number of frames you read.To display the first frame use: