How to get accumulated motion image in a video?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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
Respuesta aceptada
Image Analyst
el 16 de Oct. de 2012
Those are probably floating point arrays, so use []:
imshow(ami, []);
imshow(m, []);
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!