|
|
--- |
|
|
license: apache-2.0 |
|
|
--- |
|
|
|
|
|
|
|
|
Pose Estimation Model |
|
|
|
|
|
Overview |
|
|
|
|
|
This project implements a Pose Estimation Model using MediaPipe, OpenCV, and NumPy to analyze human body movement from images and videos. It extracts key body landmarks, calculates angles between joints, and logs the data for further analysis. |
|
|
|
|
|
Features |
|
|
|
|
|
Pose Detection: Detects and extracts body landmarks from images and videos. |
|
|
|
|
|
Angle Calculation: Computes angles between body joints to analyze posture. |
|
|
|
|
|
Distance Measurement: Measures distances between key body points. |
|
|
|
|
|
Video Processing: Processes videos frame by frame and logs body data. |
|
|
|
|
|
Data Logging: Saves pose estimation data to CSV for analysis. |
|
|
|
|
|
Model Configuration: Supports saving and loading model configurations in JSON. |
|
|
|
|
|
Dependencies |
|
|
|
|
|
Ensure you have the following Python libraries installed: |
|
|
|
|
|
pip install opencv-python mediapipe pandas matplotlib numpy |
|
|
|
|
|
Installation |
|
|
|
|
|
Clone the repository and navigate to the project directory: |
|
|
|
|
|
git clone : |
|
|
cd pose-estimation |
|
|
|
|
|
Usage |
|
|
|
|
|
1. Initialize the Model |
|
|
|
|
|
from pose_estimation import PoseEstimationModel |
|
|
model = PoseEstimationModel() |
|
|
|
|
|
2. Process an Image |
|
|
|
|
|
import cv2 |
|
|
image = cv2.imread('sample_image.jpg') |
|
|
output_image, landmarks = model.detect_pose(image, model.pose_video, display=True) |
|
|
|
|
|
3. Process a Video |
|
|
|
|
|
video_path = 'input_video.mp4' |
|
|
log_file = 'output_log.csv' |
|
|
model.process_video(video_path, log_file) |
|
|
|
|
|
4. Calculate Body Angles |
|
|
|
|
|
angles = model.body_angles(landmarks) |
|
|
print(angles) |
|
|
|
|
|
5. Save & Load Model Configuration |
|
|
|
|
|
model.save_model_config('model_config.json') |
|
|
loaded_model = PoseEstimationModel.load_model_config('model_config.json') |
|
|
|
|
|
Output |
|
|
|
|
|
The processed image/video with pose landmarks overlaid. |
|
|
|
|
|
A CSV file containing body joint angles and measurements. |
|
|
|
|
|
Applications |
|
|
|
|
|
Sports Analytics: Analyze athlete posture and movement. |
|
|
|
|
|
Health & Fitness: Assist in exercise form correction. |
|
|
|
|
|
Rehabilitation: Monitor patient recovery through movement tracking. |
|
|
|
|
|
Gaming & AR: Use body pose as input for interactive applications. |
|
|
|
|
|
License |
|
|
|
|
|
This project is licensed under the apache-2.0 License. |
|
|
|
|
|
|