A computer vision-based system for tracking and analyzing wrist range of motion (ROM) using colored markers. Designed for physical therapy and rehabilitation tracking with real-time feedback and comprehensive progress analytics.
Real-time wrist motion tracking and progress analytics
- Color Marker Detection: Tracks orange, yellow, pink, and blue markers
- Angle Calculation: Precise measurement of radial and ulnar deviation angles
- Live Feedback: Instant "GREAT", "TOO FAR", or "TOO LITTLE" guidance
- Dual Arm Support: Configurable for left or right wrist
- Session Tracking: Duration, movement count, and accuracy percentage
- Personal Bests: Maximum achieved angles for both movement types
- Trend Analysis: Shows improvement, decline, or stable performance patterns
- Historical Data: Session summaries saved for long-term progress tracking
- Manual Recording: Press
SPACEBARto capture specific angles - Reset Function: Press
Rto clear recorded measurements - Easy Exit: Press
ESCto save session and exit
- results.csv: Continuous logging of all movements with timestamps
- recorded_angles.csv: Manually recorded angle measurements
- progress_history.json: Comprehensive session analytics and trends
- Python 3.7 or higher
- Webcam/camera for motion capture
- Colored markers (orange, yellow, pink, blue)
pip install numpy opencv-python pysine statisticsgit clone https://github.com/yourusername/wrist-motion-capture.git
cd wrist-motion-capture
python mocap.py- Attach Markers: Secure colored markers to your wrist device
- Position Camera: Ensure clear view of all markers
- Configure Lighting: Good lighting improves marker detection
When you run the program, you'll be prompted to enter:
- Arm Selection: Left (L) or Right (R) wrist
- ROM Targets: Minimum and maximum angles for radial deviation
- ROM Targets: Minimum and maximum angles for ulnar deviation
- Live Display: Three windows show camera feed, marker tracking, and progress
- Real-time Feedback: Visual and text feedback on movement quality
- Manual Recording: Press
SPACEBARwhen you achieve a target angle - Reset Recordings: Press
Rto clear manual recordings - Exit: Press
ESCto save session and close
| Key | Action |
|---|---|
ESC |
Exit and save session |
SPACEBAR |
Record current angle |
R |
Reset recorded angles |
- Camera Feed: Raw camera input
- Angle Tracking: Processed view with marker detection and lines
- Progress Display: Statistics and feedback overlay
- Current Angle: Live angle measurement with movement type
- Session Stats: Total movements and accuracy percentage
- Personal Bests: Maximum achieved angles
- Recorded Angles: Count and last manually recorded value
- Trend Indicator: Performance trajectory (โ โ โ)
At the end of each session, you'll see:
=== SESSION SUMMARY ===
Duration: 5.2 minutes
Total movements: 150
Accuracy: 78.5%
Average angle: 42.3ยฐ
Radial movements: 75 (max: 65.2ยฐ)
Ulnar movements: 75 (max: 58.7ยฐ)
Manual recordings: 8 angles saved
Recorded angles: [45.2, 52.1, 38.9, 61.3, 44.7, 59.8, 47.2, 55.6]
=======================
- results.csv: Timestamp, angle, movement type, feedback for every movement
- recorded_angles.csv: Manually recorded measurements with context
- progress_history.json: Session analytics for tracking improvement over time
To include your demo photo/video:
- Create a
demofolder in your project directory - Add your screenshot as
demo/screenshot.png - The README will automatically reference it
- Add your video file as
demo/demo_video.mp4 - Alternative: Upload to YouTube/Vimeo and replace the link:
[Watch Demo Video](https://youtu.be/your-video-id)
wrist-motion-capture/
โโโ mocap.py # Main application
โโโ README.md # This file
โโโ demo/ # Demo media folder
โ โโโ screenshot.png # Interface screenshot
โ โโโ demo_video.mp4 # Sample session video
โโโ results.csv # Generated: Movement data
โโโ recorded_angles.csv # Generated: Manual recordings
โโโ progress_history.json # Generated: Session summaries
- Camera not detected: Ensure webcam is connected and not used by other apps
- Markers not tracking: Check lighting and color contrast
- ESC not working: Click on camera window first, then press ESC
- Import errors: Run
pip installcommand for missing packages
- Use bright, distinct colors (orange, yellow, pink, blue)
- Ensure good lighting without shadows
- Keep markers visible to camera at all times
- Clean marker surfaces for better color detection
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-feature) - Commit your changes (
git commit -am 'Add new feature') - Push to the branch (
git push origin feature/new-feature) - Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with OpenCV for computer vision capabilities
- Designed for physical therapy and rehabilitation applications
- Supports research in motion analysis and recovery tracking
Note: This system is for educational and research purposes. Consult healthcare professionals for medical applications.