手势检测 [英] HandGesture Detection

查看:71
本文介绍了手势检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行这个时:

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

我收到此错误:

ValueError: not enough values to unpack (expected 3, got 2)

我也试过:

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

和:

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

并收到此错误:

Traceback (most recent call last):
  File "C:/Users/HASHMATI/AppData/Local/Programs/Python/Python37-32/new2hand.py", line 152, in <module>
    gestureRecognition(frame,roi_rect,frame[y:y+h, x:x+w])
  File "C:/Users/HASHMATI/AppData/Local/Programs/Python/Python37-32/new2hand.py", line 99, in gestureRecognition
    detectGesture(src,roi_rect,img_dilated)
  File "C:/Users/HASHMATI/AppData/Local/Programs/Python/Python37-32/new2hand.py", line 21, in detectGesture
    contours,_,hierarchy = cv2.findContours(thresh.copy(),cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
ValueError: not enough values to unpack (expected 3, got 2)

推荐答案

cv2.findContours() 返回两个值且无法解包到轮廓、层次和_

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

应该是这样的:

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

或更多:

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

这篇关于手势检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆