Skip to content

arartawil/Smart-Rehab-Analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smart Rehab Analyzer

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.

Features

  • 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

System Requirements

  • 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

Installation

Step 1: Clone or Download

Download the Smart Rehab Analyzer files to your computer and extract them to a folder (e.g., Smart Rehab Analyzer).

Step 2: Install Python

If you don't have Python installed:

  • Download Python 3.7+ from python.org
  • During installation, make sure to check "Add Python to PATH"

Step 3: Install Required Packages

Open a command prompt or terminal in the Smart Rehab Analyzer folder and run:

pip install -r requirements.txt

Alternative Installation (if above fails):

pip install opencv-python mediapipe PySide6 numpy pandas pygame sounddevice

Step 4: Verify Installation

Run the application to verify everything is working:

python main.py

Quick Start Guide

1. Launch the Application

python main.py

2. Setup Session

  • 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)

3. Start Exercise Session

  • 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)

4. Monitor Progress

Real-time feedback includes:

  • Current joint angle
  • Repetition count
  • Movement smoothness score
  • Pose detection status

5. Complete Session

  • Click "Stop Session" when finished
  • Review the session summary
  • Click "Save Data" to export results to CSV
  • Use "Reset" to start a new session

Understanding the Metrics

Joint Angles

  • Measured in degrees
  • For elbow: 180° = full extension, lower values = more flexion
  • Real-time display shows current angle

Repetition Counting

  • Automatically detects complete movement cycles
  • Configurable threshold (minimum angle change required)
  • Audio beep plays on valid repetition detection

Smoothness Score

  • Scale of 0-100 (higher = smoother movement)
  • Based on velocity and jerk analysis
  • Helps assess movement quality and control

Range of Motion (ROM)

  • Difference between maximum extension and flexion angles
  • Indicates exercise effectiveness and joint mobility

Data Export

CSV File Columns

  • patient_id: Patient identifier
  • session_id: Session identifier
  • rep_id: Repetition number
  • timestamp: Time of measurement
  • angle: Joint angle in degrees
  • smoothness: Movement smoothness score
  • peak_angle: Maximum angle in repetition
  • valley_angle: Minimum angle in repetition
  • range_of_motion: ROM for the repetition
  • date: Date of session
  • time: Time of measurement

File Locations

  • Data files saved to: data/ folder
  • Log files saved to: logs/ folder
  • Export format: PatientID_SessionID_Timestamp.csv

Troubleshooting

Camera Issues

  • 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

Audio Issues

  • No sound: Check if audio feedback is enabled in settings
  • Audio errors: The system will fall back to visual-only feedback

Performance Issues

  • Slow response: Lower camera resolution or close other applications
  • High CPU usage: Normal during video processing; ensure adequate system resources

Installation Issues

# 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

Advanced Usage

Customizing Settings

  • 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

Batch Analysis

The data exporter can create comprehensive reports across multiple sessions for progress tracking.

Integration

CSV data can be imported into Excel, MATLAB, R, or other analysis tools for advanced statistics and visualization.

File Structure

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

Support and Updates

Known Limitations

  • 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)

Future Enhancements

  • Multiple exercise types
  • Real-time progress comparison
  • Cloud data synchronization
  • Mobile app companion
  • Therapist dashboard

License

This software is provided as-is for educational and research purposes. Please ensure compliance with local healthcare regulations when used in clinical settings.

Contact

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages