Foreground detection with OpenCV

preview_player
Показать описание
An example of a program made with OpenCV to detect the foreground on a security camera.
How it works?
1.Generate a model of the scene
a)Save 30 frames
b)For each pixel calculate the average and the standard deviation
2. Compare each frame with the model and extract the foreground
3. Clean the foreground and draw rectangles over the bigger areas

Code:
Рекомендации по теме
Комментарии
Автор

thanks dude that was the vid i am looking for although i am not copying your code
i needed a preview, , thanks again
and thanks for the algo.:)
the similar thing i am doing for car detection on the road...
i have got a good idea how to do thanks again

ChaitanyaVarmaD
Автор

Hi,
OpenCV doesn't have a built in foreground detector.
But it's easy to write your own using a principle like mean background substraction.

guillermobarbadillo
Автор

I have fixed the link. Please check it.

guillermobarbadillo
Автор

Hi, the code is available in the description.

Thanks

guillermobarbadillo
Автор

Yes, I waw following the book Learning OpenCV, OReilly.
I have uploaded all the programs at the url in the description

guillermobarbadillo
Автор

Just out of curiosity are you using mean background subtraction in your program or does OpenCV have a built in foreground detector like MATLAB?

MrDuvies
Автор

nice work! I've read your code. Is that in this video the background already analyzed, therefore "Historic" or g_hist shows "0" ?

dclanmaster
Автор

Good job! You can help me, I making a project that uses OpenCV and I have problems with foreground detection. You can send your code to me?

AlessandroMenezes
Автор

I have fixed the link. Please check it.

guillermobarbadillo