python-3.x - ValueError:没有足够的值使用OpenCV中的Contour解包(预期3,得到2)

标签 python-3.x opencv jupyter-notebook opencv-contour

所以我在更新所有软件包后收到此错误。

    <ipython-input-48-e9a9716d4b8c> in extractText(path)
     15     plt.show()
     16 
---> 17     img, contours, hierarchy = cv2.findContours(edged, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)
     18     contours = sorted(contours, key=cv2.contourArea, reverse=True)
     19 

ValueError: not enough values to unpack (expected 3, got 2)

最佳答案

在openCV4中,cv2.findContours()返回2个值contours, hierarchy,因此应为:

contours, hierarchy = cv2.findContours(edged, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)

关于python-3.x - ValueError:没有足够的值使用OpenCV中的Contour解包(预期3,得到2),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54435296/

相关文章:

python - Jupyter 笔记本 : "RuntimeError: Permissions assignment failed for secure file: ... Got ' 0o160 0' instead of ' 0o060 0' "

python - 两个不同编辑器中的相同种子给我不同的结果(Pycharm 和 Jupyter Notebook)

python - 如何修复数据类型不匹配以使用我的训练模型预测图像?

python - 在 Python 中设置推导式并测试正在创建的集合中的成员资格

Python:使用与不带空格的字符串输入匹配的文本文件查找单词

python-3.x - 我该怎么做才能提高 opencv 中的视频质量

android - 在android中缩小图像时找不到点的位置

python-3.x - 使用 pymongo 从 csv 插入数组

opencv - 屏幕上的窗口数(OpenCV)

python - 如何使用Api Key而不直接在python代码中使用它?