Borrar filtros
Borrar filtros

How to get accumulated motion image in a video?

3 visualizaciones (últimos 30 días)
Ramya Sampath
Ramya Sampath el 14 de Oct. de 2012
I need accumulated image of a video... I tried with the following code.... But i get wrong output... Can anyone help me and findout error in my code....
%Testing the input video file
%Accumulated motion%
[FileName PathName] = uigetfile('*.avi','Select a video file for testing','D:\ME PROJECT\daria bend.avi');
file = fullfile(PathName,FileName);
robj = mmreader(file);
vidfrm = read(robj);
%frm=double(vidfrm);
dur = robj.Duration
numF = robj.NumberOfFrames
%Computation of ami
m=0;
for k=2:numF;
f1=vidfrm(:,:,:,k);
imshow(f1);
h1=getframe;
%[x,map]=frame2im(h1);
g1=rgb2gray(f1);
f2=vidfrm(:,:,:,k-1);
imshow(f2);
h2=getframe;
%[x1,map1]=frame2im(h2);
g2=rgb2gray(f2);
g=imabsdiff(g1,g2);
m=m+g;
end
m;
figure(1),imshow(m);
ami=m/numF;
figure(2),imshow(ami);
Sorry i cannot upload video now.. use any grayscale video like weizmann dataset for it... Actually the figure(2) have to dipaly some accumulated o/p when it is divided by total num of frames.. But i get ly black screen... Pls help me...!
  2 comentarios
Matt J
Matt J el 14 de Oct. de 2012
Editada: Matt J el 14 de Oct. de 2012
I suggest that you remove "Urgent..." from your title, before someone comes along and closes your question down.
Also, you should markup your code to make it more readable.
Ramya Sampath
Ramya Sampath el 16 de Oct. de 2012
Sorry... I removed it now... Pls explain and answer my question... Now its clear i think...

Iniciar sesión para comentar.

Respuesta aceptada

Image Analyst
Image Analyst el 16 de Oct. de 2012
Those are probably floating point arrays, so use []:
imshow(ami, []);
imshow(m, []);

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by