第四步
寻找轮廓并记录在返回的 contours列表 中:
image, contours, _1 = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE...)
第五步
根据轮廓数据表,在三通道彩色图片上绘制轮廓:
contoured_colored_img = cv2.drawContours(img, contours, -1, (0, 0, 255),...也可以在黑白三通道图片上绘制轮廓:
thresh_expanded = np.expand_dims(thresh, axis=2)
gray_img = np.concatenate([thresh_expanded