[opencv] Use the image contour function to fill the interior of the contour

 _, thresh = cv2.threshold(
img, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
 # 使用cv.RETR_CCOMP寻找轮廓
 contours, hierarchy = cv2.findContours(thresh, cv2.RETR_CCOMP, 2)
 # 绘制轮廓内部
cv2.drawContours(img, contours, i, 255, -1)

Insert image description here
Insert image description here

Guess you like

Origin blog.csdn.net/thunder_k/article/details/129879337