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!
