![]() |
VOOZH | about |
Imagine you’re watching CCTV footage and want to track only moving people or cars not the walls, buildings or parked vehicles. This is where Background Subtraction comes in.
Background Subtraction is a computer vision technique used to separate moving objects (foreground) from static scenes (background) in a video. The result is usually a binary mask (black-and-white image) that highlights moving parts.
Shadows of moving objects can also move and sometimes algorithm mistakenly marks them as part of the foreground. Some background subtraction methods handle shadows better than others.
It demonstrates background subtraction using OpenCV’s MOG2 algorithm. It reads a video, applies background subtraction to separate moving objects (foreground) from background and displays both original video and processed mask in real time.
Original Frame:
👁 Image
Foreground Mask:
Explanation: