我正在使用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.
更多推荐
发布评论