Advanced ergonomic monitoring via Computer Vision & Machine Learning
π¦ Installation β’ β¨ Features β’ π― Interface β’ π Build β’ π€ Contributing
BioPosture is a cross-platform software platform for real-time kinematic analysis and ergonomic monitoring of the cervical spine. By leveraging Computer Vision algorithms and neural networks for pose estimation (MediaPipe Framework), the system turns a standard webcam into a precision biometric sensor.
The primary goal is the prevention of musculoskeletal disorders (MSDs) related to prolonged VDT (Video Display Terminal) use, providing immediate visual biofeedback to correct pathomechanical postural deviations such as Text Neck Syndrome.
Research background: BioPosture was developed as part of an experimental study (N=20 subjects, age 14β80) that validated markerless cervical posture assessment against goniometry using Bland-Altman analysis (bias: +1.67Β°, LoA: Β±4.10Β°, r=0.96). The study demonstrated a statistically significant postural worsening (+7Β° CSA, p=0.0215) and screen approach (β5.7 cm, p=0.0006) under cognitive load.
- IT Professionals: Developers, designers, analysts working 8+ hours at a computer
- Remote Workers: Working from home without certified ergonomic setups
- Students: Long study sessions at the computer
- Gamers: Injury prevention during extended gaming sessions
- Offices: Corporate wellness program implementation
| Technology | Function | Version |
|---|---|---|
| MediaPipe | 3D pose estimation with 33 body landmarks + 468 face mesh landmarks | 0.10+ |
| OpenCV | Real-time video processing (30 fps) | 4.8+ |
| CustomTkinter | Modern cross-platform UI | 5.2+ |
| NumPy | Vector computation and signal smoothing | 1.24+ |
- Head Tilt: Cervical rotation detection (Β±90Β°)
- Shoulder Asymmetry: Muscular load imbalance analysis
- Screen Distance: Monitoring based on interpupillary distance proxy
- Cervical Tension: Ear-shoulder ratio for forward head posture detection
- Personalized Calibration (5 seconds): Morphological adaptation per user
- Dynamic Baseline: User-specific postural reference points
- On-Demand Recalibration: Update parameters at any time
| Operating System | Notification Method |
|---|---|
| Windows 10/11 | Windows Toast Notifications (winotify) |
| macOS | Notification Center (osascript) |
| Linux | Desktop Notifications (notify-send) |
- Configurable Cooldown: Prevents notification spam (default: 8 seconds)
- Delayed Alert Timer: Tolerance for transient errors (default: 5 seconds)
- Session Efficiency: Percentage of time with correct posture
- Real-Time Chart: Temporal trend of critical parameters (60 samples)
- CSV Export: Metrics export for in-depth analysis
- Data Persistence: Configuration saved in cross-platform JSON
- Material Design Theme: Professional palette with glass morphism
- Dark/Light Mode: Dynamic theme switching without restart
- System Tray Integration: Discreet background operation
- Optimized Video Feed: 768px rendering with landmark overlay
- Cross-Platform Autostart:
- Windows: Registry
HKCU\Software\Microsoft\Windows\CurrentVersion\Run - macOS: LaunchAgents (
~/Library/LaunchAgents/) - Linux: Desktop files (
~/.config/autostart/)
- Windows: Registry
- Minimized Launch:
--minimizedflag for startup to tray - Smart Pause: Temporary deactivation without closing the app
# Download installer from Releases page
https://github.com/antdf87/BioPosture/releases/download/v2.0/BioPosture_Setup_v2.0.exe
# Run with administrator privileges
.\BioPosture_Setup_v2.0.exePost-Installation:
- Automatic Desktop shortcut
- Start Menu entry
- Uninstall via Control Panel
# Download DMG
curl -L -o BioPosture.dmg \
https://github.com/antdf87/BioPosture/releases/download/v2.0/BioPosture_v2.0_macOS.dmg
# Open and install
open BioPosture.dmg
# Drag BioPosture.app to /ApplicationsFirst Launch:
- Right-click β Open (bypass Gatekeeper)
- Allow Camera: System Settings β Privacy & Security β Camera
- Allow Notifications: System Settings β Notifications
# Download and extract
wget https://github.com/antdf87/BioPosture/releases/download/v2.0/BioPosture_v2.0_linux_x86_64.tar.gz
tar -xzf BioPosture_v2.0_linux_x86_64.tar.gz
# Run
cd BioPosture_v2.0_linux_x86_64
./BioPosture-
Launch Application
- Windows: Start Menu β BioPosture
- macOS: Launchpad β BioPosture
- Linux: Application Menu β BioPosture
-
Initial Calibration (REQUIRED)
βββββββββββββββββββββββββββββββββββββββββββ β Before starting monitoring, β β you need to calibrate the system: β β β β 1. Sit in CORRECT posture β β 2. Look straight at the camera β β 3. Click "START CALIBRATION" β β 4. Hold position for 5 seconds β βββββββββββββββββββββββββββββββββββββββββββ -
Calibration Confirmation
- Status:
MONITORING ACTIVE(green) - Baseline values saved automatically
- Status:
ββββββββββββββββββββββββββββββββββββββββββ
β [Camera: 0 βΌ] [Stop] [βοΈ Controls] β
ββββββββββββββββββββββββββββββββββββββββββ€
β β
β π₯ WEBCAM FEED + OVERLAY β
β β
β β’ Face landmarks (iris) β
β β’ Body landmarks (ears/shoulders) β
β β’ Postural reference lines β
β β
ββββββββββββββββββββββββββββββββββββββββββ
Card 1: Postural Parameters
βββββββββββββββββββββββββββββββββββββββββ
β POSTURAL PARAMETERS β
βββββββββββββββββββββββββββββββββββββββββ’
β Head Tilt β 3.5Β° β
β Shoulder Asymmetry β 2.1Β° β
β Screen Distance β 58 cm β
β Cervical Tension β 94% β
βββββββββββββββββββββββββββββββββββββββββ
Card 2: Session Efficiency
βββββββββββββββββββββββββββββββββββββββββ
β SESSION EFFICIENCY β
β ββββββββββββββββββββ 82% β
βββββββββββββββββββββββββββββββββββββββββ
Card 3: Real-Time Chart
βββββββββββββββββββββββββββββββββββββββββ
β Ξ β
β β β±β² β±β² β
β β β± β² β± β² β±β² β
β β β± β²β± β² β± β² β
β ββββββββββββββββββββββ> t β
β Head (red) | Neck (green) β
βββββββββββββββββββββββββββββββββββββββββ
Card 4: Configuration
βββββββββββββββββββββββββββββββββββββββββ
β TOLERANCE THRESHOLD β
β [βββββββββββββ] 50% β
β β
β β Autostart β Notifications β Lightβ
βββββββββββββββββββββββββββββββββββββββββ
| Function | Description |
|---|---|
| Recalibrate | Update postural baseline |
| Pause | Temporarily disable monitoring |
| Stop Camera | Stop video acquisition |
| Save KPIs | Export CSV with session metrics |
| Minimize to Tray | Continue monitoring in background |
{
"thresholds": {
"soglia_angoli": 10.0, // Angle tolerance (degrees)
"soglia_dist_max": 1.35, // Maximum distance (ratio)
"soglia_dist_min": 0.65, // Minimum distance (ratio)
"soglia_compressione": 0.85, // Cervical tension (ratio)
"tempo_allarme": 5.0, // Seconds before alert
"cooldown_notifica": 8.0 // Seconds between notifications
}
}Config file location:
- Windows:
%APPDATA%\BioPosture\config.json - macOS:
~/Library/Application Support/BioPosture/config.json - Linux:
~/.config/BioPosture/config.json
| Component | Minimum | Recommended |
|---|---|---|
| RAM | 4 GB | 8 GB |
| CPU | Dual-core 2.0 GHz | Quad-core 2.5 GHz+ |
| Webcam | 720p 30fps | 1080p 30fps |
| Python | 3.8 | 3.11 |
| Storage | 500 MB | 1 GB |
git clone https://github.com/antdf87/BioPosture.git
cd BioPostureWindows:
python -m venv venv
venv\Scripts\activatemacOS/Linux:
python3 -m venv venv
source venv/bin/activatepip install --upgrade pip
pip install -r requirements.txtCore dependencies:
customtkinter==5.2.0 # UI Framework
opencv-python==4.8.0 # Computer Vision
mediapipe==0.10.0 # Pose Estimation
numpy==1.24.0 # Numeric Computing
Pillow==10.0.0 # Image Processing
pystray==0.19.0 # System Tray
pyinstaller==6.0.0 # Packaging
winotify==1.1.0 # Windows Notifications (Windows only)
python bioposture_interface.py# 1. Compile binary
python build_scripts\build_windows.py
# Output: dist\BioPosture.exe (standalone)
# 2. Create NSIS installer
# Prerequisite: NSIS installed (https://nsis.sourceforge.io/)
# Right-click installers\windows\installer.nsi β "Compile NSIS Script"
# Output: BioPosture_Setup_v2.0.exeFinal size: ~220 MB (includes Python runtime + libraries)
# 1. Generate .icns icon
mkdir BioPosture.iconset
# ... (generate all sizes)
iconutil -c icns BioPosture.iconset -o BioPosture.icns
# 2. Compile bundle
python build_scripts/build_macos.py
# Output: dist/BioPosture.app
# 3. (Optional) Create DMG
brew install create-dmg
create-dmg \
--volname "BioPosture Installer" \
--window-size 800 400 \
--icon "BioPosture.app" 200 190 \
--app-drop-link 600 185 \
"BioPosture_v2.0_macOS.dmg" \
"dist/BioPosture.app"Final size: ~70 MB (universal Intel/ARM bundle)
# 1. Install system dependencies
sudo apt install python3-tk libnotify-bin libgtk-3-0
# 2. Compile binary
python build_scripts/build_linux.py
# Output: dist/BioPosture
# 3. (Optional) Create .deb β see build_scripts/create_deb.sh
# 4. (Optional) Create AppImage β see build_scripts/create_appimage.shFinal size: ~150 MB (includes Python + dependencies)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β BioPosture Application β
β (bioposture_interface.py) β
ββββββββββββββ¬ββββββββββββββββββββββββββββββββ¬βββββββββββββββββ
β β
ββββββββββΌβββββββββ ββββββββββΌβββββββββ
β UI Layer β β Core Engine β
β CustomTkinter β β Processing β
β + Pystray β β β
ββββββββββ¬βββββββββ ββββββββββ¬βββββββββ
β β
ββββββββββΌβββββββββ ββββββββββΌββββββββββββββββββ
β Config Manager β β Computer Vision Pipeline β
β - JSON I/O β β βββββββββββββββββββββββ β
β - Persistence β β β OpenCV Camera β β
β β β β (30 FPS capture) β β
β Autostart Mgr β β ββββββββββββ¬βββββββββββ β
β - Registry/ β β β β
β LaunchAgent/ β β ββββββββββββΌβββββββββββ β
β .desktop β β β MediaPipe Face Mesh β β
βββββββββββββββββββ β β (468 landmarks) β β
β ββββββββββββ¬βββββββββββ β
β β β
β ββββββββββββΌβββββββββββ β
β β MediaPipe Pose β β
β β (33 landmarks) β β
β ββββββββββββ¬βββββββββββ β
β β β
β ββββββββββββΌβββββββββββ β
β β Geometry Calculator β β
β β - Angles β β
β β - Distances β β
β β - Ratios β β
β ββββββββββββ¬βββββββββββ β
β β β
β ββββββββββββΌβββββββββββ β
β β EMA Data Smoother β β
β β (Ξ± = 0.75 default) β β
β ββββββββββββ¬βββββββββββ β
β β β
β ββββββββββββΌβββββββββββ β
β β Threshold Evaluator β β
β β + Severity Scaling β β
β βββββββββββββββββββββββ β
βββββββββββββββββββββββββββ
Camera Frame (30 FPS)
β
βββ RGB Conversion
β
βββ MediaPipe Face Detection
β βββ Iris Landmarks (468, 473)
β βββ Interpupillary Distance
β
βββ MediaPipe Pose Detection
β βββ Upper Body Landmarks (7, 8, 11, 12)
β βββ Head Tilt Angle [arctan2(ear_r - ear_l)]
β βββ Shoulder Tilt Angle [arctan2(sh_r - sh_l)]
β βββ Neck Length Ratio [dist(ear, shoulder) / dist_iris]
β
βββ Exponential Moving Average Smoothing (Ξ± = 0.7β0.8)
β
βββ Threshold Evaluation
β βββ Calibration Baseline Ξ
β βββ Severity Factor Scaling
β βββ Temporal Delay (5s default)
β
βββ Status Update (UI + Tray Icon Color)
β
βββ Notification Dispatch (if threshold exceeded)
βββ OS-Specific Method
βββ Windows : winotify
βββ macOS : osascript
βββ Linux : notify-send
def calc_angle(p1: np.ndarray, p2: np.ndarray) -> float:
"""
Calculates the angle between two points relative to horizontal.
Args:
p1, p2: Coordinates [x, y] in pixels
Returns:
Angle in degrees [-180, 180]
"""
return np.degrees(np.arctan2(p2[1] - p1[1], p2[0] - p1[0]))class DataSmoother:
def __init__(self, alpha: float = 0.75):
"""
Exponential Moving Average filter for real-time noise reduction.
Args:
alpha: Smoothing factor [0, 1]
Low alpha = more smoothing (slower response)
High alpha = less smoothing (faster response)
"""
self.alpha = alpha
self.val = None
def update(self, new_val: float) -> float:
if self.val is None:
self.val = new_val
else:
self.val = self.alpha * new_val + (1 - self.alpha) * self.val
return self.val# User sets severity 0β100%
severity = config["ui"]["severity"] / 100.0
# Adaptive tolerance factors
tolerance_factor = 1.5 - severity # range [0.5, 1.5]
time_factor = 2.0 - (severity * 1.5) # range [0.5, 2.0]
# Adaptive thresholds
angle_threshold = base_angle_threshold * tolerance_factor
alert_delay = base_alert_delay * time_factor
# High severity β tighter threshold + faster alert| Platform | Version | Camera | System Tray | Notifications | Autostart |
|---|---|---|---|---|---|
| Windows 10 | 22H2 | β | β | β | β |
| Windows 11 | 23H2 | β | β | β | β |
| macOS Monterey | 12.7 | β | β | β | β |
| macOS Ventura | 13.6 | β | β | β | β |
| macOS Sonoma | 14.2 | β | β | β | β |
| Ubuntu | 22.04 LTS | β | β | β | β |
| Ubuntu | 24.04 LTS | β | β | β | β |
| Debian | 12 | β | β | β | β |
- macOS < 10.15: MediaPipe not supported (requires Catalina+)
- Linux Wayland: System tray may not appear (X11 limitation)
- Chromebook Linux (Crostini): Camera not shared with container
Contributions are strongly welcome! BioPosture is an open-source project that improves with community feedback.
| Area | Priority | Skills |
|---|---|---|
| Postural Algorithms | π΄ High | Computer Vision, Biomechanics |
| UI/UX Improvements | π Medium | Design, Tkinter |
| Cross-Platform Testing | π‘ Medium | QA, Multi-OS |
| Documentation | π’ Low | Technical Writing |
| Translations | π’ Low | Foreign languages |
Open an Issue with:
**Bug Description:**
[Clear and concise description]
**Steps to Reproduce:**
1. Open application
2. Perform action X
3. Observe behavior Y
**Expected Behavior:**
[What should happen]
**Actual Behavior:**
[What happens instead]
**Environment:**
- OS: [Windows 11 / macOS 14.2 / Ubuntu 22.04]
- BioPosture Version: [2.0]
- Webcam: [Model]
**Screenshot/Log:**
[Attach if available]Open a Discussion to discuss the idea before implementing it.
This project is released under the MIT License.
MIT License
Copyright (c) 2025 AntDF87
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
[... see LICENSE.txt for full text]
Antonio Del Fine (AntDF87) Biomedical Engineer | Computer Vision & ML
- π GitHub: @antdf87
- π§ Issues & Support: GitHub Issues
If you use this software for academic or research purposes, please cite the project using the included CITATION.cff file or the following BibTeX:
@software{BioPosture2025,
author = {Del Fine, Antonio},
title = {BioPosture: Real-Time Markerless Postural Monitoring System},
year = {2025},
version = {2.0.0},
url = {https://github.com/antdf87/BioPosture}
}This project would not be possible without:
- Google MediaPipe β ML framework for pose estimation
- OpenCV Foundation β Computer Vision library
- Tom Schimansky β CustomTkinter framework
- Moses Palmer β Pystray library
- Open Source Community β For feedback and contributions
- Documentation: Read this guide
- FAQ: Check the Wiki (coming soon)
- Issues: Search existing issues
- Discussions: Ask the community
- β Star the repo on GitHub
- π’ Share with colleagues and friends
- π Report bugs to help improve the project
- Machine Learning for complex postural pattern recognition
- Weekly analytics dashboard and PDF reports
- Gamification system (streaks, goals, badges)
- Integrated stretching exercise recommendations
- EMG sensor integration for muscle fatigue quantification
- Optoelectronic system validation (gold standard)
- REST API for third-party health platform integration
- Mobile companion app








