关于opencv 轮廓检测 中的 ValueError: too many values to unpack ,ValueError: not enough values to unpack (expected 3, got 2)
Opencv2代码实现
contours, hierarchy = cv2.findContours(binary,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
函数原型
cv2.findContours(image, mode, method[, contours[, hierarchy[, offset ]]])
返回两个值:contours;hierarchy。
Opencv3代码实现
image,cnts,hierarchy=cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
返回三个值:image;contours;hierarchy。