how to use the previous frame of a video in a loop without saving it

2 visualizzazioni (ultimi 30 giorni)
hello,
I am trying to compute the silhoutte motion image from a silhouette of video, i want to perform all the steps in a sequence with saving the silhouette and then working on it. as my application is real-time
i used this code to extract the silhouette
v = VideoReader('2.mp4');
nFrames = v.NumberOfFrames;
for f=1:nFrames
I=read(v,f);
if f==1
Background=I;
Fg=abs(I-Background);
else
Fg=abs(I-Background);
end
grayImage = rgb2gray(abs(im2double(Fg))); % Convert to gray level
thresholdLevel = graythresh(grayImage);
binaryImage = im2bw(grayImage,thresholdLevel);
% now for the silhouette motion image i have to compute
for n=1:f
if f==1
smi1=binaryImage;
else
smi1=abs(binaryImage+binaryImage(previous frame i.e (f-1));
end
end
smii=abs(smi1-bi);
my question is how do i access the previous frame within the loop, without saving it
  2 Commenti
KSSV
KSSV il 20 Feb 2020
Where you are reading the frame...there you use your calculation....simple.
Saba Baloch
Saba Baloch il 20 Feb 2020
Thanks for your response, but i want to work on the already processed frame, how do i use a frame that has already been processed

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by