Adaptive background Subtraction Algorithm
显示 更早的评论
Hi every one
I have a problem while applying threshold into the Adaptive background Algorithm My code is
threshold=25
for f=1:frames
I=read(obj,f);
figure(1);imshow(I);title('Input Video Sequence');
if f==1
Background=I;
Fg=abs(I-Background);
else
Fg=abs(I-Background);
end
end
for i=1:width
for j=1:height
if Fg(i,j)>threshold
Fg(i,j)=255;
else
Fg(i,j)=0;
end
end
end
figure(2);imshow(Fg);
This is a video file in which I am applying this algorithm but when I apply the threshold conditions the results does not effect and I cannot get the foreground mask.
Thanks in advance
采纳的回答
更多回答(2 个)
Laura Proctor
2012-12-24
There are a couple things that I notice in this code. First, I'm not sure, but I think that you might want to apply the threshold to each frame, in which case, you should put the threshholding inside the for loop when reading each frame. Second, you can achieve this threshholding without using a for loop.
Try this:
threshold=25;
for f=1:frames
I=read(obj,f);
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
6 个评论
Algorithms Analyst
2012-12-24
Algorithms Analyst
2012-12-24
Nusrat jahan
2019-2-1
why i found error in :
for f=1:frames
undifined function or variable frames ?
Image Analyst
2019-2-2
You have to determine the number of frames in your video before you call that code.
matin
2020-3-24
could you please tell me what obj and f are in this code?
Image Analyst
2020-3-24
f is the frame number that you want to read. obj is what you get returned when you call VideoReader. What you have is just a snippet that left out a fully working demo. See my answer below for several video processing demos.
Image Analyst
2020-3-24
0 个投票
See several attached video processing demos.
1 个评论
Fego Etese
2020-3-24
Please Image Analyst, I need your help on this question https://uk.mathworks.com/matlabcentral/answers/512047-how-can-i-find-out-if-two-minutiae-points-in-a-fingerprint-image-are-on-the-same-ridge
Sorry for the bother, but i really need your help as I am lost.
Thanks.
类别
在 帮助中心 和 File Exchange 中查找有关 Image Segmentation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
