在图像中我们有6个图形的轮廓,我们使用代码来计算和查找轮廓。
查找前景对象的轮廓(即轮廓),使用阈值化处理后的图像:
cnts = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL,
cv2.CHAIN_APPROX_SIMPLE)
cnts = imutils.grab_contours(cnts)
output = image.copy()
在轮廓上循环,在输出图像上用3px粗紫色绘制每个轮廓线outline,然后一次显示一个输出轮廓:
for c in cnts:
cv2.drawContours(output, [c], -1, (240, 0, 159), 3)
cv2.imshow("Contours", output)
cv2.waitKey(0)
cv2.findContours:以检测图像中的轮廓。


4857

被折叠的 条评论
为什么被折叠?



