Skip to content

MelodyccLo/WorkutePoseAnalyze

Repository files navigation

WorkutePoseAnalyze

A Python computer vision toolkit for analyzing workout videos. Uses MediaPipe and OpenCV to detect body poses, calculate joint angles, and generate exercise configuration data. Includes multiple analyzer variants for different use cases, Excel-to-JSON conversion tools, and a Flask upload API.

Tech Stack

Category Technology
Language Python 3
Vision MediaPipe Pose, OpenCV
Data NumPy, Pandas
API Flask, Werkzeug
Notebooks Jupyter

Features

  • Real-time pose detection -- MediaPipe tracks body landmarks from video, calculating angles for shoulders, elbows, armpits, waist, and knees (left and right).
  • Multiple analyzer modes -- Choose from basic, interactive, averaging, or range-display analyzers depending on the analysis workflow.
  • Categorized pose capture -- Tag captured poses with category keys (0-9) and get per-category summaries with average, min, and max angles.
  • Excel-to-JSON conversion -- Transform exercise definition spreadsheets into structured JSON configurations for the Workute platform.
  • Video upload API -- Flask endpoint for receiving workout videos (up to 500MB) with automatic timestamped file naming and logging.

Tools Overview

Video Analyzers

Script Description
workout_analyzer.py Basic analyzer -- pause video with spacebar to view joint angles
workout_analyzer_interactive.py Categorize poses with 0-9 keys, get summary with averages
workout_analyzer_avg.py Configurable angle range width, category-based summaries
workout_analyzer_range.py Enhanced terminal display with min/max angle columns

Data Conversion

Script Description
excel_json.py Read 3 Excel sheets and output exercise JSON to console
excel_jsontxt.py Same conversion, saves to .txt file with dynamic naming

Upload API

Script Description
upload_api.py Flask server (port 5003) accepting video uploads via POST

Getting Started

Prerequisites

  • Python 3.8+
  • pip

Installation

git clone https://github.com/MelodyccLo/WorkutePoseAnalyze.git
cd WorkutePoseAnalyze

pip install mediapipe opencv-python numpy pandas flask

Usage

Run a video analyzer:

python workout_analyzer_interactive.py
  • Press spacebar to pause and capture the current pose
  • Press 0-9 to assign the capture to a category
  • Press q to quit and view the summary

Convert Excel to JSON:

python excel_json.py

Start the upload API:

python upload_api.py

API Reference

POST /upload-video

Upload a workout video file for processing.

Field Type Description
file file Video file (mp4, mov, avi, mkv, webm, max 500MB)

GET /ping

Health check endpoint. Returns a timestamp.

Project Structure

WorkutePoseAnalyze/
├── workout_analyzer.py              # Basic pose analyzer
├── workout_analyzer_interactive.py  # Interactive categorized analyzer
├── workout_analyzer_avg.py          # Averaging analyzer
├── workout_analyzer_range.py        # Range display analyzer
├── excel_json.py                    # Excel to JSON converter
├── excel_jsontxt.py                 # Excel to JSON text file converter
├── upload_api.py                    # Flask video upload API
├── video/                           # Test videos
├── Excel to Json/                   # Sample Excel templates
├── json txt/                        # Sample JSON output
└── jupyternotebook/                 # Exploratory notebooks

About

Using Google Mediapipe to analyze workout pose and output body angles data. Update the data into sample excel file to get Json for Workute server.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors