Remove background and image noise

I am trying to remove the background from the video and get binary images (or 8-bit), where the value of the object that is moving is 1 and the static background is 0.

something like that:

enter image description here

I tried this first, getting the difference absDiff() from the average accumulateWeighted() and the current frame , but the result was not what I expected (only the edges were 1, and inside the moving object it was 0).

so I went to createBackgroundSubtractorMOG2 and createBackgroundSubtractorMOG , but this is also not good (same problem).

Is there a way to get the whole moving object?

+5
source share
1 answer

A mixture of the Gaussians method will not solve all your problems. A common problem is sensitivity to lighting conditions, for example. attaching a shadow to the selected foreground object. If the image scenario (background) is approximately the same, you can refine the results with some image processing.

If the background looks like the one in the attached image, try building a color histogram in the HSI space, create an image of the extracted foreground object (not a mask, the actual color image) and remove pixels that are similar to the floor (a color known from skin detection methods). This way you can remove some shadows attached to the person / objects.

In addition, if real-time processing is not critical in your application, you can use more sophisticated background / foreground detection, such as SubSENSE .

0
source

Source: https://habr.com/ru/post/1259355/


All Articles