Background subtraction algorithm for real time video?

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 件のコメント

nabihaa izzaty
nabihaa izzaty 2018 年 4 月 19 日
Hi David, can I know the code for background substraction for the image and the video files?
Image Analyst
Image Analyst 2018 年 4 月 19 日
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.

サインインしてコメントする。

 採用された回答

Image Analyst
Image Analyst 2014 年 2 月 16 日
編集済み: Image Analyst 2014 年 2 月 16 日

1 投票

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 件のコメント

Pruthvi
Pruthvi 2014 年 2 月 19 日
Thank you!
iup geii amiens
iup geii amiens 2014 年 5 月 19 日
Hello Sir,
please, can I know you are refering to which method in your demo??
Thank you very much for all what you are doing!
Image Analyst
Image Analyst 2014 年 5 月 19 日
The method is called "subtraction".
iup geii amiens
iup geii amiens 2014 年 5 月 20 日
Thank you for your response but there is a lot of methods working on "substraction" or "Background substraction" :)
iup geii amiens
iup geii amiens 2014 年 5 月 28 日
Hello Sir, I tried to implement the method of «A Robust Background Subtraction and Shadow Detection» for background subtraction and it is working with fixed thresholds Talpha2 et Talpha2. But i want to make these thresholds automatic, Do you have any idea please? Talpha1 must be the value of alphan at r (detection rate) and Talpha2 the value of alphan at (1-r). Thanks a lot PS; my method is attached below.
Image Analyst
Image Analyst 2014 年 5 月 28 日
編集済み: Image Analyst 2014 年 5 月 28 日
lup, I have no idea what those are or how to calculate them. Why can't you just make a function to determine Talpha1 and Talpha2 "automatically" based on other parameters?
david csernay
david csernay 2017 年 10 月 4 日
編集済み: david csernay 2017 年 10 月 4 日
I know this is an old theard, but could somebody pls attach a final version of the code for real time video background subtraction? I get errors when i change read() to getsnapshot(). thank you
Mrityunjay Jha
Mrityunjay Jha 2020 年 4 月 28 日
Hello Sir. Can I get the description for this code, so that it will be easy to understand?
Image Analyst
Image Analyst 2020 年 4 月 28 日
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.

サインインしてコメントする。

その他の回答 (1 件)

Nitin
Nitin 2014 年 2 月 16 日

0 投票

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