findContours:ValueError: too many values to unpack (expected 2)
作者:互联网
@[TOC](findContours:ValueError: too many values to unpack (expected 2))
contours, hierarchy = cv2.findContours(bw, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)#函数更改了
contours=sorted(contours, key=len)
cnt = contours[-1]
print('轮廓:')
print(cnt.shape)
shapeF = cnt
# cv2.drawContours(img, shapeF, -1, (0, 0, 255), 3)
cv2.drawContours(img, contours, -1, (0, 0, 255), 2)
cv2.imshow('contours', img)
一年前的代码现在运行不行了
更改位置
```python
binary,contours, hierarchy = cv2.findContours(bw, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)
总结:函数接收参数更改了。
标签:cnt,img,更改,findContours,many,cv2,values,contours 来源: https://blog.csdn.net/z12306/article/details/122584704