Issue with CoG Velocity Calculation: Units and Near-Zero Results #5846
Labels
os:windows
MediaPipe issues on Windows
platform:python
MediaPipe Python issues
stat:awaiting response
Waiting for user response
Have I written custom code (as opposed to using a stock example script provided in MediaPipe)
Yes
OS Platform and Distribution
Windows 10 Home Basic 64 - bit
MediaPipe Tasks SDK version
0.10.20
Task name (e.g. Image classification, Gesture recognition etc.)
Pose Estimation
Programming Language and version (e.g. C++, Python, Java)
Python
Describe the actual behavior
The calculated CoG velocity is consistently near zero, even though the CoG position changes visibly in the video. This suggests a unit conversion issue or a problem with the calculation method.
Describe the expected behaviour
The CoG velocity should reflect the actual movement speed of the body's center of gravity, expressed in meters per second (m/s).
Standalone code/steps you may have used to try to get what you need
import cv2 import mediapipe as mp import numpy as np from scipy.signal import savgol_filter # ... (MediaPipe initialization and video capture) CoG_positions = [] while cap.isOpened(): # ... (MediaPipe pose processing) if results.pose_landmarks: landmarks = results.pose_landmarks.landmark CoG_x_pixel, CoG_y_pixel, CoG_z_pixel = calculate_body_center(landmarks) # Your CoG calculation function CoG_positions.append([CoG_x_pixel, CoG_y_pixel, CoG_z_pixel]) # ... (after the loop) CoG_positions = np.array(CoG_positions) # Velocity calculation (this is where I suspect the problem lies) CoG_velocities = np.diff(CoG_positions, axis=0) * fps # ... (smoothing and plotting)
Other info / Complete Logs
The text was updated successfully, but these errors were encountered: