opencv 2.4.9中findcontour函数返回的值是什么(what are values returned by findcontour function in opencv 2.4.9)

编程入门 行业动态 更新时间:2024-10-25 08:20:01
opencv 2.4.9中findcontour函数返回的值是什么(what are values returned by findcontour function in opencv 2.4.9)

我正在使用openCV 2.4.9版本,我所指的代码有以下行: im2,contours,hier=cv2.findContours(im_th.copy(),cv2.RETR_EXTERNAL,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)

我一直收到错误:“ValuesError:需要2个以上的值来解包”我明白openCV的2.4.9版本中的findContour只返回两个值。 但这些价值观是什么?

i'm using openCV 2.4.9 version and the code i was referring to had the following line: im2,contours,hier=cv2.findContours(im_th.copy(),cv2.RETR_EXTERNAL,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)

I keep getting the error : "ValuesError : need more than 2 values to unpack " I understand that findContour in 2.4.9 version of openCV returns only two values. But what are those values ?

最满意答案

OpenCV文档包含返回类型的所有详细信息。 也许你应该经历过那一次。 请参阅此以了解层次结构。 要纠正错误,请使用 -

contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

您目前使用的是OpenCV 3。

The OpenCV documentation has all the details of the return types. May be you should go through that once. See this to understand hierarchy. To correct your error, use-

contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

What you are currently using is for OpenCV 3.

更多推荐

本文发布于:2023-07-27 05:03:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1285483.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:函数   findcontour   opencv   returned   values

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!