[STM32N6] 视觉识别案例2-人体姿态估计库 mediapipe

[复制链接]
 楼主| 一路向北lm 发表于 2025-4-3 16:34 | 显示全部楼层 |阅读模式
<
本帖最后由 一路向北lm 于 2025-4-3 16:37 编辑

Mediapipe 是一个开源的跨平台框架,它提供了大量的解决方案,用于构建高性能、跨平台的计算机视觉应用。Mediapipe 使用计算图(Calculation Graph)来表示算法的执行流程,可以轻松地组合和扩展不同的算法模块。板卡出厂的demo中展示的就是mediapipe的姿态检测。
7703667ee483060a32.png
5499967ee4837333ef.png
人脸检测
  1. mp_face_detection = mp.solutions.face_detection
  2. # 创建 FaceDetection 类实例
  3. face_detection = mp_face_detection.FaceDetection()
  4. # 读取图像
  5. img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
  6. # 检测图像中的人脸
  7. results = face_detection.process(img_rgb)
  8. # 绘制人脸矩形框
  9. if results.detections:
  10.     for detection in results.detections:
  11.         mp_drawing.draw_detection(img, detection)<span style="color: rgb(25, 27, 31); font-family: -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Microsoft YaHei&quot;, &quot;Source Han Sans SC&quot;, &quot;Noto Sans CJK SC&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif; font-size: 1.1em; background-color: rgb(255, 255, 255);">手势识别</span>
手势识别
  1. mp_hands = mp.solutions.hands
  2. # 创建 Hand 类实例
  3. hands = mp_hands.Hands()
  4. # 读取图像
  5. img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
  6. # 处理图像
  7. results = hands.process(img_rgb)
  8. # 绘制手势关键点
  9. if results.multi_hand_landmarks:
  10.     for hand_landmarks in results.multi_hand_landmarks:
  11.         mp_drawing.draw_landmarks(
  12.             img,
  13.             hand_landmarks,
  14.             mp_hands.HAND_CONNECTIONS,
  15.         )
姿态估计
  1. mp_pose = mp.solutions.pose
  2. # 创建 Pose 类实例
  3. pose = mp_pose.Pose()
  4. # 读取图像
  5. img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
  6. # 处理图像
  7. results = pose.process(img_rgb)
  8. # 绘制姿态关键点
  9. if results.pose_landmarks:
  10.     mp_drawing.draw_landmarks(
  11.         img,
  12.         results.pose_landmarks,
  13.         mp_pose.POSE_CONNECTIONS,
  14.     )


suncat0504 发表于 2025-5-13 14:04 | 显示全部楼层
代码看起来好简洁啊,有支持库,开发真方便。
Ketose 发表于 2025-7-8 16:00 | 显示全部楼层
收一块STM32N6开发板。
szt1993 发表于 2025-7-8 19:33 | 显示全部楼层
有库开发就是方便
您需要登录后才可以回帖 登录 | 注册

本版积分规则

293

主题

3837

帖子

81

粉丝

293

主题

3837

帖子

81

粉丝
快速回复 在线客服 返回列表 返回顶部