0

I am using background subtraction, in particular MOG2 for video bgs with OpenCV.

I am currently getting the original frame and the foreground mask in two seperate opencv windows. I want to get a display of the background with the foreground removed. I am not able to find anywhere on how to do this. I can only find out how to extract the foreground from the background.

For example I have this as the original frame enter image description here

This is my foreground mask enter image description here

I want to attempt to display something like this: enter image description here

Is this possible to do with just OpenCV?

Can I cut out the masks and then convert back to RGB? My end goal is to inpaint the white mask blobs.

devman3211
  • 63
  • 1
  • 11
  • Have you tried to invert the mask (swap ones and zeroes)? If your mask is np.uint8, you may do so by `mask = 255 - mask` – K0mp0t Apr 06 '22 at 04:11
  • Since you already have the foreground mask, you can invert the image with `cv2.bitwise_not()` then bitwise-and with the original image – nathancy Apr 07 '22 at 02:18

0 Answers0