import cv2
import numpy as np
img = cv2.imread("img.jpg")
img_gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
ret, thresh = cv2.threshold(img_gray, 127, 255,0)
contours,hierarchy = cv2.findContours(thresh,2,1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "test.py", line 7, in <module>
contours,hierarchy = cv2.findContours(thresh,2,1)
When test went there, an error occuredValueError: too many values to unpack, can anyone tell me why it happened since my opencv is 3.0.0 and the findContours return two values as said in Documents and how to solve this problem
After print the result of threshold function, it returns this
(127.0, array([[255, 255, 255, ..., 255, 255, 255],
[255, 255, 255, ..., 255, 255, 255],
[255, 255, 255, ..., 255, 255, 255],
...,
[255, 255, 255, ..., 255, 255, 255],
[255, 255, 255, ..., 255, 255, 255],
[255, 255, 255, ..., 255, 255, 255]], dtype=uint8))