The code break down is pretty simple:
- Read the background first using Opencv's cap.read() and store it in a variable.
- Start capturing the video and use HSV color coding instead of BGR as it has more pallete of colors pre-defined.
- Define lower and upper bounds of your choice of color(mine was blue). and mask using InRange fcn which makes any value in that range 255.
- Convert any 255 values pixel to background pixel hence, done !