All background subtractors implement the cv2.BackgroundSubtractor interface, therefore all of them have a certain set of methods:
- cv2.BackgroundSubtractor.apply: to get the segmentation mask
- cv2.BackgroundSubtractor.getBackgroundImage: to retrieve a background image
The apply method accepts a colorful image as an argument and returns a background mask. This mask generally consists of three values: 0 for background pixels, 255 for foreground pixels, and 127 for shadow pixels. Shadow pixels are pixels in the background with lower intensity. It's worth mentioning that not all subtractors support analysis of shadow pixels.
getBackgroundImage returns a background image as it should be if there are no moving objects. Again, only ...