opencv4 中findContours函数介绍
findContours
这个函数的主要功能是找到contours也就是边界线,不过这个函数主要是给灰度图对象服务的。
函数的使用介绍:
findContours(image, mode, method[, contours[, hierarchy[, offset]]]) -> contours, hierarchy
返回值contours, hierarchy,
contours是返回的轮廓,hierarchy没有学所有还不清楚
使用的时候主要注意image最好是#compare, #inRange, #threshold ,
. #adaptiveThreshold, #Canny, 等函数处理过的图像。
mode:取“CV_RETR_EXTERNAL”,只检测外部边缘
“CV_RETR_LIST”,所有边缘,没有等级关系
“ cv2.RETR_CCOMP”建立等级,分内外边缘