HandGesture Detection

后端 未结 2 726
深忆病人
深忆病人 2021-01-28 08:54

When I run this:

contours,_,hierarchy = cv2.findContours(thresh.copy(),cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)

I get this error:

         


        
相关标签:
2条回答
  • 2021-01-28 09:08

    cv2.findContours() return two values and cannot be unpacked to contours, hierarchy and _

    It should be like this:

    contours, hierarchy = cv2.findContours(thresh.copy(),cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)

    or more:

    a, b, *others = [1, 2, 3, 4]

    0 讨论(0)
  • 2021-01-28 09:20

    This is a difference between OpenCV 3.x and 4.x. In 3.x there were three return values, in 4.x there are only two. As the others mentioned, you only catch contours and hierarchy:

    contours, hierarchy = cv2.findContours(thresh.copy(),cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
    

    Alternatively, you can downgrade your OpenCV version, if what you actually want is to use 3.x.

    0 讨论(0)
提交回复
热议问题