跳绳计数识别 |
您所在的位置:网站首页 › js计数器的实现原理 › 跳绳计数识别 |
基于mediapipe的跳绳计数识别。 Mediapipe是google的一个开源项目,支持很多常见的AI功能,如人脸检测、手势跟踪、人体姿态估计等。 人体姿态估计,给出了人体姿态的33个关键点的关键坐标,见下图: 人体中心变化 记录(23, 24)和(11, 12)关键点的变化,维持一段时间的中心最高点和最低点。 跳绳计数 依据中心点的前后变化状态实现跳绳计数。 代码github 依赖 pip install -r requirements.txt 运行 python rope_skipping_counter.py import cv2 import matplotlib.pyplot as plt import mediapipe as mp import numpy as np class BufferList: def __init__(self, buffer_time, default_value=0): self.buffer = [default_value for _ in range(buffer_time)] def push(self, value): self.buffer.pop(0) self.buffer.append(value) def max(self): return max(self.buffer) def min(self): buffer = [value for value in self.buffer if value] if buffer: return min(buffer) return 0 # file file_name = "mda-kc1e2xm7b3t9vzgt.mp4" mp_drawing = mp.solutions.drawing_utils mp_drawing_styles = mp.solutions.drawing_styles mp_pose = mp.solutions.pose # center y selected_landmarks = [23, 24] buffer_time = 80 center_y = BufferList(buffer |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |