13. 人体骨骼关键点识别

13.1. 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(10)
while True:
    smart_camera.person_keypoint_detect.recognize()
    if len(smart_camera.person_keypoint_detect.keypoints) != 0:
        print(str('骨骼关键点数据') + str(smart_camera.person_keypoint_detect.keypoints))

13.2. mPython图形化示例

../../../../_images/%E4%BA%BA%E4%BD%93%E9%AA%A8%E9%AA%BC%E5%85%B3%E9%94%AE%E7%82%B9%E8%AF%86%E5%88%AB.png

13.3. 人体关键点位置示意图

../../../../_images/%E4%BA%BA%E4%BD%93%E5%85%B3%E9%94%AE%E7%82%B9%E4%BD%8D%E7%BD%AE%E7%A4%BA%E6%84%8F%E5%9B%BE.jpg

13.4. 关键点数据格式

13.4.1. 17个骨骼关键点数据按照以下顺序排列:

  1. 鼻子

  2. 左眼

  3. 右眼

  4. 左耳

  5. 右耳

  6. 左肩

  7. 右肩

  8. 左肘

  9. 右肘

  10. 左腕

  11. 右腕

  12. 左髋

  13. 右髋

  14. 左膝

  15. 右膝

  16. 左踝

  17. 右踝

13.4.2. 示例数据

[[344.8, 84.40001, 0.9], [344.8, 78.9, 0.8], [339.2, 78.9, 0.9], [355.8, 78.9, 0.5], [328.2, 78.9, 0.7], [361.2, 106.2, 1.0], [312.0, 111.8, 1.0], [388.5, 117.2, 0.9], [295.5, 150.0, 0.9], [432.2, 122.8, 0.8], [306.5, 188.2, 0.8], [344.8, 188.2, 1.0], [312.0, 193.8, 1.0], [344.8, 232.2, 0.9], [323.0, 237.5, 0.9], [328.2, 286.8, 0.8], [312.0, 292.2, 0.8]]

每个骨骼关键点数据包含三个元素,分别是x坐标、y坐标和置信度。置信度表示模型对该关键点位置的预测准确程度,数值范围通常在0到1之间,数值越大表示预测越准确。