cv::findContours - Serbipunk/notes GitHub Wiki

clockwise?

https://stackoverflow.com/questions/45323590/do-contours-returned-by-cvfindcontours-have-a-consistent-orientation

method

https://stackoverflow.com/a/8830981

  • CV_RETR_EXTERNAL gives "outer" contours, so if you have (say) one contour enclosing another (like concentric circles), only the outermost is given. 只给出最外侧边界

  • CV_RETR_LIST gives all the contours and doesn't even bother calculating the hierarchy -- good if you only want the contours and don't care whether one is nested inside another. 给出所有边界 , 不计算层级关系

  • CV_RETR_CCOMP gives contours and organises them into outer and inner contours. Every contour is either the outline of an object, or the outline of an object inside another object (i.e. hole). The hierarchy is adjusted accordingly. This can be useful if (say) you want to find all holes. 给出边界,并按照内外轮廓格式输出,每个轮廓的属性中内外必居其一。

external contours of the object (ie its boundary) are placed in hierarchy-1 外1位: 外部轮廓 外2位: 内部

  • CV_RETR_TREE calculates the full hierarchy of the contours. So you can say that object1 is nested 4 levels deep within object2 and object3 is also nested 4 levels deep. 计算所有边界和从属关系

RETR_CCOMP example

image

RETR_TREE example

grandpa, father, son, grandson

image

https://blog.csdn.net/qinglingLS/article/details/106270095#t3