need source code for display frames of the results from video pieces in one axes only.. how can be looping ?

 Accepted Answer

If you use image() or imagesc() to display the images, then you can pass them the X and Y coordinates of the center of the lower left and upper right pixels. To display another image in the same axes, you would specify a different (X,Y) coordinate pair for the second image.

More Answers (1)

Here's a snippet of source code if you need it:
mov = aviread(movieFullFileName);
% Determine how many frames there are.
numberOfFrames = size(mov, 2);
for frame = 1 : numberOfFrames
% Extract the frame from the movie structure.
thisFrame = mov(frame).cdata;
% Display it
axes(handleToYourAxisControl);
image(thisFrame);
caption = sprintf('Frame %4d of %d.', frame, numberOfFrames);
title(caption, 'FontSize', 15);
drawnow; % Force it to refresh the window.
end

4 Comments

image analyst maybe you can help me : this is my code, can you fix it ?....:
obj=VideoReader(video);
global frame1;global frame2;global frame3;global frame4;global frame5;
global frame6;global frame7;global frame8;global frame9;global frame10;
global frame11;global frame12;global frame13;global frame14;global frame15;
global frame16;global frame17;global frame18;global frame19;global frame20;
global frame21;global frame22;global frame23;global frame24;global frame25;
global frame26;global frame27;global frame28;global frame29;global frame30;
global frame31;global frame32;
numFrames=obj.NumberOfFrames;
vidHeight = obj.Height;
vidWidth = obj.Width;
disp(numFrames);
a=length(numFrames);
disp(a);
if(~isempty(get(handles.nmvideo,'String')))
try
for frame = 1:NumberOfFrames;
frame=read(obj,1);
axes(handles.axes1);
imshow(1);
end
catch
msgbox('Codec AVI tidak didukung atau Corupted file AVI','Error','error');
return;
end
else
msgbox('Anda harus memilih video terlebih dahulu','Error','error');
end
hhhmmmm..... walter roberson, after running , msgbox under catch display "Codec AVI tidak didukung atau Corupted file AVI','Error','error'" ..... whyy?
Is the AVI coded at a variable bit rate? If so then you need to read it through once before you know the correct NumberOfFrames .
I suggest that you change the 'error' of your final msgbox() argument:
s = lasterror();
msgbox('Codec AVI tidak didukung atau Corupted file AVI','Error',s.message);

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!