Ask Your Question

Revision history [back]

How can I use the Imgproc.findContours() only on a certain portion of an image, and not the whole image?

I have an image containing a multitude of shapes. I want to find and count only those shapes that are heptagons. Just to figure out if the shape in the image is a heptagon or not, I find that shape's circularity (using contour area and arc length) in the image, and test to see if it matches within a reasonable margin of the actual circularity value of a heptagon. Therefore, how can I take an image containing a multitude of shapes, and perform the OpenCV Java Imgproc.findContours() method on each of the shapes individually, and not the whole image? I belive it may have something to do with finding the white space between each shape.

Your help is very much appreciated.