Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Include multiple objects in one contour

I have a problem and I am not sure how to accomplish it. I am working with binary Mat objects that contain many small objects in them. I have used findContours to generate each objects contour and used contourArea to calculate their area. If the objects are too small they are removed from the image. The next step tests for the distance between contours, if the contours are close enough they should be grouped together when their contour is drawn. The function works up until the objects need to be grouped into one contour. After a lot of reading and trying things out I am unable to figure this out. If any one is able to provide guidance I would appreciate it.

Here is an image for what I would like the output to be: https://i.imgur.com/BlyjRbY.png. The white blobs are the objects and the red line is my desired contour.

click to hide/show revision 2
No.2 Revision

updated 2014-09-02 01:37:11 -0600

berak gravatar image

Include multiple objects in one contour

I have a problem and I am not sure how to accomplish it. I am working with binary Mat objects that contain many small objects in them. I have used findContours to generate each objects contour and used contourArea to calculate their area. If the objects are too small they are removed from the image. The next step tests for the distance between contours, if the contours are close enough they should be grouped together when their contour is drawn. The function works up until the objects need to be grouped into one contour. After a lot of reading and trying things out I am unable to figure this out. If any one is able to provide guidance I would appreciate it.

Here is an image for what I would like the output to be: https://i.imgur.com/BlyjRbY.png. be:image description

The white blobs are the objects and the red line is my desired contour.