【发布时间】:2018-08-01 09:00:11
【问题描述】:
我有一些关于轮廓图像分割的问题。例如我得到了cable image,我可以用阈值和drawcontour函数来勾勒这个图像的轮廓,代码在下面。 Contoured image,threshold image。我的问题是我想提取这条电缆并阅读 rgb 代码。任何建议都可能很棒!谢谢。
gray_image = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
ret, thresh_img = cv2.threshold(gray_image, trs, 255, cv2.THRESH_BINARY)
im2, contours, hierarchy = cv2.findContours(thresh_img, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
cv2.drawContours(im2, contours, -1, red, cnt)
cv2.imshow(winName, im2)
【问题讨论】:
-
您能说明一下您要提取的区域吗?
-
@littlecat 我需要通过分离图像中的电缆来读取颜色。
标签: python python-3.x opencv image-processing opencv-contour