From: Lledó Esquerra Ortells on
I am working on Motion Detection. In order to load the mpg file I use the mmreader function and then when I try to display it, it looks like the images are plotted three times in each frame.
I do not know the reason, maybe I'm wrongly using the function or maybe it's because I've to use another function in order to load the mpg files.
Can anyone suggest me how to proceed?
Here is my code:

obj=mmreader(video);
nFrames=obj.NumberOfFrames
vidHeight=obj.Height
vidWidth=obj.Width
mov(1:nFrames)=struct('cdata', zeros(vidHeight,vidWidth, 3, 'uint8'), 'colormap', []);
for k=1:nFrames
mov(k).cdata=read(obj,k);
mov(k).colormap=[];
end
movie(mov,1,obj.FrameRate)
%imshow(mov(1).cdata)

thank you