简体   繁体   English

在带有 pyhton 的 Google Colab 上:ValueError: not enough values to unpack (expected 3, got 2)

[英]on Google Colab with pyhton: ValueError: not enough values to unpack (expected 3, got 2)

I am trying to read a GitHub repo that Detect "Car Number Plate" and I'm running it on google colab.我正在尝试阅读检测“车牌”的GitHub 存储库,并且我在 google colab 上运行它。
but I'm receiving this error when it tries to find contours:但是当它试图找到轮廓时我收到了这个错误:

ValueError: not enough values to unpack (expected 3, got 2) ValueError:没有足够的值来解包(预期 3,得到 2)

here's my code:这是我的代码:

```
(new, cnts, _) = cv2.findContours(edged.copy(), cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
cnts=sorted(cnts, key = cv2.contourArea, reverse = True)[:30] 
NumberPlateCnt = None
```

Thanks for any help!谢谢你的帮助!

To make it easier to answer your question it would be very useful to have the full stack trace so that we can see clearly in which line the code fails.为了更容易回答您的问题,拥有完整的堆栈跟踪非常有用,这样我们就可以清楚地看到代码在哪一行失败。

But, I assume that the error is raised in (new, cnts, _) = cv2.findContours(...) because cv2.findContours() only returns a tuple of two (contours and hierarchy).但是,我假设错误是在(new, cnts, _) = cv2.findContours(...)中引发的,因为cv2.findContours()只返回两个元组(轮廓和层次结构)。 You can see this in the documentation and a use case in their guide .您可以在文档和他们的指南中的用例中看到这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python 3 - ValueError:没有足够的值来解包(预期 3,得到 2) - Python 3 - ValueError: not enough values to unpack (expected 3, got 2) python:ValueError:没有足够的值要解压(预期2,得到0) - python: ValueError: not enough values to unpack (expected 2, got 0) ValueError:没有足够的值来解包(预期为 2,得到 1)? - ValueError: not enough values to unpack (expected 2, got 1)? ValueError:没有足够的值来解包(预期为 3,得到 2) - ValueError: not enough values to unpack (expected 3, got 2) ValueError 没有足够的值来解包(预期为 4,得到 2) - Django - ValueError not enough values to unpack (expected 4, got 2) - Django Networkx - ValueError:没有足够的值来解包(预期 3,得到 2) - Networkx - ValueError: not enough values to unpack (expected 3, got 2) ValueError:没有足够的值来解包(预期 3,得到 2)。 变压器编码器 - ValueError: not enough values to unpack (expected 3, got 2). TransformerEncoder ValueError:没有足够的值来解包(预期 1,得到 0) - ValueError: not enough values to unpack (expected 1, got 0) ValueError:没有足够的值来解包(预期 5,得到 4) - ValueError: not enough values to unpack (expected 5, got 4) ValueError:没有足够的值来解包(预期 3,得到 0) - ValueError: not enough values to unpack (expected 3, got 0)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM