OpenCV python: ValueError: too many values to unpack

前端 未结 7 1065
借酒劲吻你
借酒劲吻你 2020-11-30 01:39

I\'m writing an opencv program and I found a script on another stackoverflow question: Computer Vision: Masking a human hand

When I run the scripted answer, I get th

7条回答
  •  既然无缘
    2020-11-30 02:17

    I'm using python3.x and opencv 4.1.0 i was getting error in the following code :

    cnts, _ = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)
    
    ERROR : too many values to Unpack
    

    then i came to know that above code is used in python2.x SO i just replaced above code with below one(IN python3.x) by adding one more '_' in the left most side have a look

    _,cnts, _ = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)
    

提交回复
热议问题