difference between CV_RETR_LIST,CV_RETR_TREE,CV_RETR_EXTERNAL?

前端 未结 2 1065
忘掉有多难
忘掉有多难 2021-01-30 17:59

I am using cvFindContour function of opencv and in it there is a parameter RETR_TYPE means retrivel type,hence I am not getting what is the difference between CV_RETR_LIST

2条回答
  •  攒了一身酷
    2021-01-30 18:17

    Look at the documentation for findContours.

    The main difference is in the hierarchy that is returned (giving the relationship between one contour and the next).

    • 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.
    • 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.

提交回复
热议问题