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

2 次查看(过去 30 天)
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 个评论
KSSV
KSSV 2020-2-20
Where you are reading the frame...there you use your calculation....simple.
Saba Baloch
Saba Baloch 2020-2-20
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

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by