Adaptive background Subtraction Algorithm
Mostra commenti meno recenti
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
Risposta accettata
Più risposte (2)
Laura Proctor
il 24 Dic 2012
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 Commenti
Algorithms Analyst
il 24 Dic 2012
Algorithms Analyst
il 24 Dic 2012
Nusrat jahan
il 1 Feb 2019
why i found error in :
for f=1:frames
undifined function or variable frames ?
Image Analyst
il 2 Feb 2019
You have to determine the number of frames in your video before you call that code.
matin
il 24 Mar 2020
could you please tell me what obj and f are in this code?
Image Analyst
il 24 Mar 2020
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
il 24 Mar 2020
0 voti
See several attached video processing demos.
1 Commento
Fego Etese
il 24 Mar 2020
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.
Categorie
Scopri di più su Image Segmentation in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
