Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Getting position of object calculated from background subtraction

I have been playing around with background subtractor MOG2 and have been able to get an output foreground mask where only the moving object in the video is shown.

The problem is sometimes the object can be split into multiple 'shapes' separated by black. Some examples:

image description

image description

What I would like to do is just get a bounding box of the detected object and therefore know its position in the frame. I have tried a basic findCountours function on the mask but that didn't pick the object as a single shape.