A simple webcam-based posture detection app
This project uses pose landmark detection to analyze the user's posture and provide real-time feedback. It is designed to be run in the background to help the user maintain good posture while working for long periods at their computer.
- Python 3.10 (required)
- A webcam
Download Python 3.10 from the official website:
https://www.python.org/downloads/latest/python3.10/
brew install python@3.10which python3.10
python3.10 --version python3.10 -m venv venvOn macOS / Linux:
source venv/bin/activate On Windows:
venv\Scripts\activate python -m pip install --upgrade pip
python -m pip install -r requirements.txtpython src/main.pyUpon startup, the setup menu will appear.
Ensure:
- Your shoulders, neck, and head are all fully visible
- You are square to the webcam
You should see pose landmarks overlaid on the webcam feed.
Sit in a comfortable, upright position and click "Set"
Your default posture is now set, and the program will begin detecting. If you intentionally slouch the program should detect your poor posture.
Use the slider to adjust the sensitivity value. This will differ from user to user. Find a comfortable value that suits you.
You may repeat Step 3 at any time to set a new default posture.
Press "Start"
The program will now begin running and the setup window will minimize. If the program detects poor posture while you are working, a pop-up warning message will appear in the top left coner of your screen. This message disappears when posture is corrected.
Restore the window and click "End" to close the program.
For the best performance, it is recommended to keep the window minimized until you wish to close the program.
Lighting and camera placement can affect detection accuracy.
This project uses MediaPipe, licenced under the Apache License 2.0
https://github.com/google/mediapipe