Background subtraction algorithm for real time video?

6 vues (au cours des 30 derniers jours)
Pruthvi
Pruthvi le 16 Fév 2014
Commenté : Image Analyst le 28 Avr 2020
How do I perform background subtraction for video input from my web cam? I know how to do this for images and video files, but not for real time video.
  2 commentaires
nabihaa izzaty
nabihaa izzaty le 19 Avr 2018
Hi David, can I know the code for background substraction for the image and the video files?
Image Analyst
Image Analyst le 19 Avr 2018
nabihaa, my code in my answer gives code to subtract an image (generated from the average of some prior frames) from the current frame. Of course you could adapt it to subtract a constant, fixed image that you read from disk if you want. That should be trivial.

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 16 Fév 2014
Modifié(e) : Image Analyst le 16 Fév 2014
This is done in my demo, attached below. You just need to adapt it to call getsnapshot instead of read() so that it get image from your webcam rather than a video file.
  9 commentaires
Mrityunjay Jha
Mrityunjay Jha le 28 Avr 2020
Hello Sir. Can I get the description for this code, so that it will be easy to understand?
Image Analyst
Image Analyst le 28 Avr 2020
I'm attaching the latest version. I think it's pretty well commented. Again, it's for a video but you need to change read() to getsnapshot() or whatever the command for a web cam is if you want to do it in real time rather than from a pre-recorded video.

Connectez-vous pour commenter.

Plus de réponses (1)

Nitin
Nitin le 16 Fév 2014
You could get the frames from each video and apply your algorithm on each one. Is speed the issue here?

Community Treasure Hunt

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

Start Hunting!

Translated by