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

조회 수: 3 (최근 30일)
Saba Baloch
Saba Baloch 2020년 2월 20일
댓글: Saba Baloch 2020년 2월 20일
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