Skip to content

About

A browser-based posture monitor using MediaPipe landmarks, calibrated geometry and session feedback, with camera processing on the device.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

Posture Monitor: MediaPipe Pose, browser-side processing and calibrated geometric posture feedback. Concept landmark illustration.

Features · Geometry · Run locally · Privacy & limitations · Explore

Posture Monitor is a static web application that uses MediaPipe Pose to estimate upper-body landmarks and provide real-time posture feedback. Camera frames are processed in the browser and are not uploaded by this project.

This is a heuristic posture aid, not a medical device or diagnostic tool.

Features

Live feedback, calibration, detection validation, session counters, a static interface and browser-side processing.

How it works

Camera frame to landmarks, validity gate, features, baseline comparison and feedback. Invalid upper-body detections prompt repositioning.

Normalized geometric features: f1 = 10 × |L − R| / W; f2 = (L + R) / W. L and R are face-centre-to-shoulder distances; W is shoulder width.

The browser computes two normalized geometric features:

  • f1 measures left-right asymmetry between face-to-shoulder distances.
  • f2 measures the combined face-to-shoulder distance relative to shoulder width.

The classifier compares those measurements with a baseline. Before calibration it uses conservative defaults; after calibration it uses the user's current upright pose. This is a heuristic posture aid, not a medical device or diagnostic tool.

Calibration and counters

Detail Current implementation
Calibration Enabled only after a valid measurement; saves the current f1 and f2 as the new baseline
Slouching f2 - baselineF2 < -0.12; evaluated before lateral leaning
Lateral leaning abs(f1 - baselineF1) > 0.55, when the slouch condition does not apply
Event counts Increment when entering a detected state, rather than on every video frame
Invalid upper-body detection Disables calibration and resets the active slouch/lean state flags
Session timer Starts after camera playback begins; counters are not persisted between reloads

The geometry uses normalized landmark coordinates. Calibration is a snapshot of the current accepted frame, not a multi-frame training step. The illustrated landmarks below and above are conceptual artwork, not a recording or measured result.

Run locally

Camera access requires a secure context. Localhost is treated as secure by modern browsers.

python -m http.server 8000

Open http://localhost:8000, allow camera access, sit fully in frame, and select Calibrate posture while sitting upright.

The page loads MediaPipe and Google Fonts from public CDNs, so the first load requires an internet connection.

Optional Python tools

Create an environment and install the tooling dependencies:

python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txt

Re-download the reference dataset:

python tools\fetch_dataset.py

Rebuild the Word reports:

python tools\generate_docs.py

Deploy

The application is static and can be deployed to Vercel or another HTTPS static host. Keep index.html, style.css, and script.js together at the site root.

Privacy and limitations

Camera frames are not uploaded or stored by this project. CDN assets require an internet connection on first load. The reference CSV is not training data for the live classifier.

  • This project does not transmit or store camera frames.
  • MediaPipe assets and fonts are fetched from third-party CDNs.
  • Counts are session-only and reset when the page reloads.
  • Accuracy depends on lighting, camera placement, visibility, and calibration.
  • The tool should not be used to diagnose or treat a health condition.

Explore the project

Interface source: The web application’s entry point Tracking logic: Landmarks, calibration and feedback Reference dataset: Exploration data, not live training data Team & contributions: Project roles and contribution notes

Project structure and reference-dataset notes
.
|-- index.html                 Web interface
|-- style.css                  Responsive presentation
|-- script.js                  Camera, MediaPipe, geometry, and UI logic
|-- vercel.json                Static Vercel configuration
|-- requirements.txt           Optional Python tooling dependencies
|-- data/
|   `-- hf_posture_dataset.csv  Reference dataset for exploration
|-- docs/
|   |-- CONFERENCE_REPORT.docx
|   |-- PROJECT_THESIS.docx
|   `-- TEAM_ROLES.md
`-- tools/
    |-- fetch_dataset.py       Re-downloads the reference dataset
    `-- generate_docs.py      Rebuilds the Word reports

The reference dataset contains Upright, Stiff, and Slouched labels. Its schema does not match the live f1 and f2 features and it has no lateral-lean class, so it is not presented as training data for the browser classifier.

Posture Monitor: Notice the shift. Find your baseline. A heuristic posture aid, not a medical device.

Discuss an improvement · Read the geometry · Meet the builder

About

A browser-based posture monitor using MediaPipe landmarks, calibrated geometry and session feedback, with camera processing on the device.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages