關於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。