今天遇到的问题如下:
ValueError: not enough values to unpack (expected 3, got 2)
原因是 cv2.findContours的opencv旧版本返回3个值:
img, cnts, hiera = cv2.findContours(binary.copy(),cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)
新版本返回2个值:
cnts, hiera = cv2.findContours(binary.copy(),cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)
参考:
https://blog.csdn.net/weixin_45963617/article/details/105046244