Coders Packet

Background Subtraction Method using Open CV and Python

By Arushi Dwivedi

Background Subtraction Method is able to subtract or eliminate the background portion inside an image.The programming language I used is python and the technology I worked with is Open CV.

Background subtraction (BS) is a common and mostly used technique for generating the foreground mask by using static cameras or surveillance cameras to get the input data. As the name suggests, it can subtract or eliminate the background portion inside an image. The output of the Image Frame is a binary segmented image which essentially gives information about the non-stationary objects in the image.
Background Subtraction has several use cases in everyday life, It is being used for object segmentation, security enhancement, pedestrian tracking, counting the number of visitors, number of vehicles in traffic etc. It is able to learn and identify the foreground mask.
>>Steps to import packages(Opencv, etc) in your project in Pycharm Software:-
#To import these packages you need to go to file -> Setting->Project Interpreter.
#After that click on the plus icon to add packages and search for the package you want to include in your project.
The Background subtraction algorithm I used is BackgroundSubtractorMOG2:-
It uses the same concept of Gaussian Blur and BackgroundSubtractorMOG but the major advantage that it provides is in terms of stability whenever there is a change in luminosity and better identification capability of detecting and highlighting shadows in frames.

Download Complete Code

Comments

No comments yet