A comprehensive computer vision-based rehabilitation tracking system that analyzes upper-limb movements using pose estimation and provides real-time feedback for physical therapy exercises.
- Real-time Pose Estimation: Uses MediaPipe for accurate upper-limb tracking
- Joint Angle Calculation: Precise elbow and shoulder angle measurements
- Movement Analysis: Advanced metrics including repetition counting and smoothness analysis
- Audio Feedback: Real-time audio cues for exercise validation
- Visual Feedback: Live skeleton overlay and angle displays
- Data Export: Comprehensive CSV export with session tracking
- Modern GUI: User-friendly interface built with PySide6
- Session Management: Patient and session tracking capabilities
- Python: 3.7 or higher
- Operating System: Windows 10+, macOS 10.14+, or Linux (Ubuntu 18.04+)
- RAM: 4GB minimum, 8GB recommended
- Camera: USB webcam or built-in camera
- Display: 1280x720 minimum resolution
Download the Smart Rehab Analyzer files to your computer and extract them to a folder (e.g., Smart Rehab Analyzer).
If you don't have Python installed:
- Download Python 3.7+ from python.org
- During installation, make sure to check "Add Python to PATH"
Open a command prompt or terminal in the Smart Rehab Analyzer folder and run:
pip install -r requirements.txtpip install opencv-python mediapipe PySide6 numpy pandas pygame sounddeviceRun the application to verify everything is working:
python main.pypython main.py- Enter a Patient ID (e.g., "P001" or patient name)
- Session ID will be auto-generated or you can enter your own
- Select target side (Left or Right arm)
- Adjust settings if needed (repetition threshold, audio feedback)
- Click "Start Session" to begin video capture
- Position yourself so your upper body is visible in the camera
- The system will display a skeleton overlay when pose is detected
- Perform your rehabilitation exercises (e.g., arm flexion/extension)
Real-time feedback includes:
- Current joint angle
- Repetition count
- Movement smoothness score
- Pose detection status
- Click "Stop Session" when finished
- Review the session summary
- Click "Save Data" to export results to CSV
- Use "Reset" to start a new session
- Measured in degrees
- For elbow: 180° = full extension, lower values = more flexion
- Real-time display shows current angle
- Automatically detects complete movement cycles
- Configurable threshold (minimum angle change required)
- Audio beep plays on valid repetition detection
- Scale of 0-100 (higher = smoother movement)
- Based on velocity and jerk analysis
- Helps assess movement quality and control
- Difference between maximum extension and flexion angles
- Indicates exercise effectiveness and joint mobility
patient_id: Patient identifiersession_id: Session identifierrep_id: Repetition numbertimestamp: Time of measurementangle: Joint angle in degreessmoothness: Movement smoothness scorepeak_angle: Maximum angle in repetitionvalley_angle: Minimum angle in repetitionrange_of_motion: ROM for the repetitiondate: Date of sessiontime: Time of measurement
- Data files saved to:
data/folder - Log files saved to:
logs/folder - Export format:
PatientID_SessionID_Timestamp.csv
- Camera not detected: Ensure webcam is connected and not used by other applications
- Poor tracking: Improve lighting and ensure upper body is clearly visible
- Lag or stuttering: Close other applications to free up system resources
- No sound: Check if audio feedback is enabled in settings
- Audio errors: The system will fall back to visual-only feedback
- Slow response: Lower camera resolution or close other applications
- High CPU usage: Normal during video processing; ensure adequate system resources
# If pip install fails, try upgrading pip first:
python -m pip install --upgrade pip
# For permission issues on Windows:
pip install --user -r requirements.txt
# For macOS/Linux permission issues:
pip3 install --user -r requirements.txt- Repetition Threshold: Adjust sensitivity for rep detection (10-90 degrees)
- Audio Feedback: Enable/disable sound notifications
- Target Side: Switch between left and right arm analysis
The data exporter can create comprehensive reports across multiple sessions for progress tracking.
CSV data can be imported into Excel, MATLAB, R, or other analysis tools for advanced statistics and visualization.
Smart Rehab Analyzer/
│
├── main.py # Main application entry point
├── requirements.txt # Python package dependencies
├── README.md # This file
│
├── src/ # Source code modules
│ ├── __init__.py
│ ├── pose_estimator.py # Pose estimation using MediaPipe
│ ├── movement_analyzer.py # Movement analysis and metrics
│ ├── gui_interface.py # PySide6 GUI application
│ ├── audio_feedback.py # Audio notification system
│ └── data_exporter.py # CSV export functionality
│
├── data/ # Session data and exports
├── logs/ # Application log files
└── assets/ # Resources and documentation
- Requires good lighting for optimal pose detection
- Works best with contrasting clothing against background
- Single-person tracking only
- Upper-limb exercises only (can be extended for full body)
- Multiple exercise types
- Real-time progress comparison
- Cloud data synchronization
- Mobile app companion
- Therapist dashboard
This software is provided as-is for educational and research purposes. Please ensure compliance with local healthcare regulations when used in clinical settings.
For technical support or feature requests, please check the documentation or contact the development team.
Smart Rehab Analyzer v1.0.0
Making rehabilitation tracking accessible and effective