A lightweight, privacy-first, real-time rep counter for common bodyweight exercises. GC_Fit uses MediaPipe's Pose model and OpenCV to detect joint landmarks from a webcam feed and count repetitions of exercises (push-ups, sit-ups, squats) based on simple geometric rules.
Features
- Push-up, Sit-up, and Squat rep counters using Pose landmarks.
Quickstart
- Create and activate a Python 3.8+ virtualenv.
- Install requirements: pip install -r requirements.txt
- Run an exercise script, for example:
python .\PushUp.py --time 30If you want to run tests (optional):
pip install -r requirements.txt
python -m pytest -qNotes
- These scripts access your webcam. Grant permission if prompted.
- Tune the angle thresholds or camera resolution for your setup.
If the script opens a virtual camera (VCAM) instead of your physical webcam, find the correct camera index and pass it with --cam.
- Probe available devices (DirectShow on Windows):
.\.venv\Scripts\Activate.ps1
python list_cams.py --max 8This prints which indices responded and the resolution. Commonly multiple indices show up (virtual cameras and real cameras). Note indices that report OK.
- Preview each working index visually:
python testcamera.py --max 6 --preview 4This opens each index for a few seconds so you can visually identify your physical camera. Press q in the preview window to close early.
- Run the exercise script with the chosen index:
python PushUp.py --time 30 --cam 1Tips and troubleshooting
- If two indices both show 640x480, one may be a virtual camera. Close virtual camera apps (OBS, Zoom virtual camera, Snap Camera) and re-run
testcamera.py. - On Windows, Device Manager (Cameras) can help identify installed camera drivers. Disabling a virtual camera temporarily can help determine the physical camera index.
- If OpenCV can't open an index with the default backend, try the alternative backend in
testcamera.pywith--backend msmf. - Ensure no other app is blocking the webcam (Teams, Zoom, browser tabs). Close those apps and retry.
Contributing
- Open an issue or a pull request. Keep changes small and focused.
- Add tests for new functionality where practical.
License
- MIT - see
LICENSE