9. 手掌关键点分类

在AI摄像头进行手掌关键点分类。

检测手掌推理后得到关键点坐标,并计算每根手指的关节角度来识别手势(如 fist、five、gun、love 等)。

9.1. 手势

../../../../_images/%E6%89%8B%E6%8E%8C%E5%85%B3%E9%94%AE%E7%82%B9%E5%88%86%E7%B1%BB-%E6%89%8B%E5%8A%BF.png

id:0 - fist 拳头

id:1 - five 手掌

id:2 - gun 枪

id:3 - love 爱

id:4 - one 一

id:5 - six 六

id:6 - three 三

id:7 - thumbUp 点赞大拇指

id:8 - yeah 剪刀手

9.2. Python示例

例程:手掌关键点分类
#mPythonType:0
from mpython import *
import smartcamera_k230 as smartcamera

smart_camera = smartcamera.SmartCameraK230(tx=Pin.P1, rx=Pin.P0)

smart_camera.model_init(4)

while True:
    smart_camera.hand_keypoint_class.recognize()
    if smart_camera.hand_keypoint_class.gesture_id != None:
        print(str('手势id:') + str(smart_camera.hand_keypoint_class.gesture_id))
        print(str('手势字符串:') + str(smart_camera.hand_keypoint_class.gesture_str))

9.3. mPython图形化示例

../../../../_images/%E6%89%8B%E6%8E%8C%E5%85%B3%E9%94%AE%E7%82%B9%E5%88%86%E7%B1%BB.png