how to get this video background removal worked?

1 view (last 30 days)
hello everyone,
I cannot get this code working and it gives me black screen as output!
clc
clear
close all
obj = vision.VideoFileReader('1.mov');
frames= 550;
threshold=25;
for f=1:frames
I=step(obj);
%figure(1);imshow(I);title('Input Video Sequence');
if f==1
Background=I;
Fg=abs(I-Background);
else
Fg=abs(I-Background);
end
Fg(Fg>threshold) = 255;
Fg(Fg<=threshold) = 0;
figure(2);imshow(Fg);
drawnow;
pause(0.2)
end

Answers (0)

Community Treasure Hunt

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

Start Hunting!