如何进行手势识别系列-5:比耶(v型手势)识别

比耶(V形手势)

特征:

  • 食指和中指伸展,并且分开。
  • 其余三指弯曲或靠近手掌。

算法:

  1. 计算食指指尖(I4)和中指指尖(M4)之间的距离。
  2. 确保这个距离大于一个阈值。
  3. 确保其余三指(T4、R4、P4)的指尖与手腕的距离小于一个阈值。

def is_v_sign(hand_landmarks, wrist_idx=0, threshold_fingers=50, threshold_v=50):
    wrist = hand_landmarks[wrist_idx]
    index_tip = hand_landmarks[8]
    middle_tip = hand_landmarks[12]
    distance_index_middle = np.linalg.norm(np.array(index_tip) - np.array(middle_tip))
    
    if distance_index_middle < threshold_v:
        return False
    
    is_v_sign = True
    for i in [4, 16, 20]:  # Thumb, Ring, Pinky finger tips
        fingertip = hand_landmarks[i]
        distance = np.linalg.norm(np.array(fingertip) - np.array(wrist))
        if distance > threshold_fingers:
            is_v_sign = False
            break
    return is_v_sign

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值