如何进行手势识别系列-2:手掌握拳识别

手掌握拳

特征:

  • 手指关节点接近手掌根部(Wrist)。
  • 手指各节的相对距离很小。

算法:

  1. 计算每根手指(除拇指)的指尖(例如:I4、M4、R4、P4)与手腕(Wrist)之间的距离。
  2. 如果所有这些距离都小于一个阈值,则判断为握拳。

参考代码如下:

def is_fist(hand_landmarks, wrist_idx=0, threshold=50):
    wrist = hand_landmarks[wrist_idx]
    is_fist = True
    for i in [8, 12, 16, 20]:  # Index, Middle, Ring, Pinky finger tips
        fingertip = hand_landmarks[i]
        distance = np.linalg.norm(np.array(fingertip) - np.array(wrist))
        if distance > threshold:
            is_fist = False
            break
    return is_fist
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值