1 | initial version |
The function cv::findContours
(if called with cv2.RETR_TREE
parameter) returns so-called hierarchy,
which lets you find whether the contour has an inside contours (children). None of the objects on the right-hand side of your image has any internal object. The one on left has an internal object, which is the inside of the line (and another one which is the small shape in the center). It'll be better visible is you revert the colours.
Learn more about the hierarchy
here: http://docs.opencv.org/trunk/d9/d8b/tutorial_py_contours_hierarchy.html
I think, using this feature you are able to find the closed circles.
2 | No.2 Revision |
The function cv::findContours
(if called with cv2.RETR_TREE
parameter) returns so-called hierarchy,
which lets you find out whether the contour has an inside contours (children). None (children).
Assuming there will be no internal small holes left after thresholding (which can be removed using some basic morphology), none of the objects on the right-hand side of your image image has any internal object. The one on left has an internal object, which is the inside of the line (and another one which is the small shape in the center). It'll be better visible is you revert 'revert' the colours.colours in cv::threshold()
.
Learn more about the hierarchy
here: http://docs.opencv.org/trunk/d9/d8b/tutorial_py_contours_hierarchy.html
I think, using this feature you are able to find the closed circles.
3 | No.3 Revision |
The function cv::findContours
(if called with cv2.RETR_TREE
parameter) returns so-called hierarchy,
which lets you find out whether the contour has an inside contours (children).
Assuming there will be no internal small holes left inside of the lines after thresholding (which can be removed using some basic morphology), none of the objects on the right-hand side of your image has any internal object. The one on left has an internal object, which is the inside of the line (and another one which is the small shape in the center). It'll be better visible is you 'revert' the colours in cv::threshold()
.
Learn more about the hierarchy
here: http://docs.opencv.org/trunk/d9/d8b/tutorial_py_contours_hierarchy.html
I think, using this feature you are able to find the closed circles.