Remove background and noise from image


Im trying to remove the background from a video and get a binary images( or 8-bit) where value of the object that moves is 1 and static background is 0.

something like this:

enter image description here

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

so I went for createBackgroundSubtractorMOG2 and createBackgroundSubtractorMOG but this is not good either( same problem ).

is there a way to get the whole moving object?

Show source
| python   | opencv   | image-processing   | motion-detection   | background-subtraction   2016-11-06 07:11 1 Answers

Answers ( 1 )

  1. 2016-11-06 09:11

    The Mixture of Gaussians method is not going to solve all your problems. Common problem is sensitivity to light conditions, e.g. attaching shadow to extracted foreground object . If the image scenario (background) is roughly the same you can refine your results with some image processing.

    If the background is similar as in attached image, try to build color histogram in HSI space, create image of extracted foreground object (not mask, actual colored image) and remove pixels that color is similar to the floor (technique known from skin detection methods). In that way you could remove some shadows attached to the person/objects.

    Also, if real-time processing is not crucial in your application, you could use more sophisticated background/foreground detection like SubSENSE.

◀ Go back