使用OpenCV进行边沿检测运行时遇到报错:(返回三个参数)
image,contours, hierarchy = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
Traceback (most recent call last):
File “C:/Users/asus/Desktop/pythoncode/02-变量.py”, line 8, in
image,contours, hierarchy = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
ValueError: not enough values to unpack (expected 3, got 2)
原因可能是opencv为新版,返回两个参数,去掉image即可运行。