python调用cv2.findContours时报错:ValueError: not enough values to unpack (ex...
完整代码如下:import cv2
import numpy as np
img = np.zeros((200, 200), dtype=np.uint8)
img = 255
ret, thresh = cv2.threshold(img, 127, 255, cv2.THRESH_BINARY)
image, contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
color = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
img = cv2.drawContours(color, contours, -1, (0,255,0), 2)
cv2.imshow("contours", color)
cv2.waitKey()
cv2.destroyAllWindows()但是cv2.findContours报如下错误:
ValueError: not enough values to unpack (expected 3, got 2)python版本为3.6,opencv为4.0.0
变量设置检查下 空间不足了 感觉使用方式不对 是你参数少给了一个,应该给出三个,但你只给了两个
页:
[1]