Real-time posture monitoring and analysis using AI-powered pose detection
PostureGuard AI is an intelligent posture detection application that helps you maintain healthy sitting habits by providing real-time feedback on your posture using advanced computer vision and machine learning techniques.
- Real-Time Pose Detection: Live posture analysis using MediaPipe Tasks Vision
- Comprehensive Metrics: Track neck angle, trunk flexion, elbow position, knee angle, and more
- Smart Smoothing: Advanced filtering algorithms reduce noise for stable readings
- Visual Feedback: Live skeleton overlay and color-coded status indicators
- Privacy-First: All processing happens locally in your browser - no data leaves your device
- Multi-Camera Support: Choose from available cameras with automatic device detection
- Responsive Design: Works on desktop and mobile devices
- Dark/Light Theme: Toggle between themes for comfortable usage
PostureGuard-AI/
βββ app/ # Next.js 14 App Router
β βββ layout.tsx # Root layout with theme provider
β βββ page.tsx # Main application page
βββ components/ # React components
β βββ ui/ # shadcn/ui components
β β βββ badge.tsx
β β βββ button.tsx
β β βββ card.tsx
β β βββ dialog.tsx
β β βββ select.tsx
β β βββ separator.tsx
β βββ PoseDetection.tsx # Core pose detection component
β βββ PostureAnalyzer.tsx # Posture analysis and metrics display
β βββ mode-toggle.tsx # Dark/light theme toggle
β βββ theme-provider.tsx # Theme context provider
βββ lib/ # Utility libraries
β βββ poseUtils.ts # Pose analysis algorithms and utilities
β βββ utils.ts # General utilities (cn function)
βββ styles/ # Global styles
β βββ globals.css # Tailwind CSS and custom styles
βββ workers/ # Web Workers (if needed)
β βββ poseWorker.ts # Pose processing worker
βββ public/ # Static assets
β βββ favicon.ico
βββ config files # Configuration files
βββ next.config.js # Next.js configuration
βββ tailwind.config.js # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
βββ postcss.config.js # PostCSS configuration
βββ components.json # shadcn/ui configuration
- Node.js 18+ (LTS recommended)
- npm or yarn package manager
- A modern web browser with camera support
- HTTPS connection (required for camera access)
-
Clone the repository
git clone https://github.com/your-username/PostureGuard-AI.git cd PostureGuard-AI -
Install dependencies
npm install # or yarn install -
Run the development server
npm run dev # or yarn dev -
Open your browser Navigate to http://localhost:3000
# Build the application
npm run build
# Start the production server
npm start-
MediaPipe Tasks Vision: Google's advanced pose detection model
- Uses the heavy pose landmarker model for accuracy
- Detects 33 3D landmarks on the human body
- Runs entirely in the browser using WebAssembly
-
Real-Time Analysis Engine
- Calculates key posture angles (neck, trunk, limbs)
- Applies smoothing filters to reduce noise
- Provides instant feedback on posture quality
-
Advanced Metrics
- Craniovertebral Angle (CVA): Head position relative to shoulders
- Trunk Flexion: Spine alignment with vertical axis
- Pelvic Tilt: Hip alignment and stability
- Elbow Angle: Upper limb positioning
- Knee Angle: Lower limb positioning
- Confidence Score: Tracking quality assessment
-
Camera Setup
- Allow camera access when prompted
- Select your preferred camera from the dropdown
- Position yourself so your upper body is visible
-
Start Detection
- Click "Start Camera" to begin video feed
- Click "Start Detection" to begin pose analysis
- Ensure good lighting for optimal results
-
Monitor Your Posture
- Watch the real-time metrics update
- Follow the color-coded status indicators:
- π’ Green: Good posture
- π‘ Yellow: Needs improvement
- π΄ Red: Poor posture
- Read the tips and recommendations provided
// Core analysis flow
Camera Feed β MediaPipe Model β Pose Landmarks β
Angle Calculations β Smoothing Filters β
Classification β User Feedback- Angle Calculation: Vector-based angle computation between body landmarks
- Smoothing: Moving average and One-Euro filters for stable readings
- Classification: Rule-based posture assessment with configurable thresholds
- Ergonomic Scoring: Weighted composite score across multiple metrics
- Efficient landmark processing at 30 FPS
- Selective rendering to minimize GPU usage
- Smart throttling for UI updates
- Memory-efficient filter implementations
- Framework: Next.js 14 with App Router
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: shadcn/ui (Radix UI primitives)
- AI/ML: MediaPipe Tasks Vision
- Build Tool: Next.js built-in bundler
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Local Processing: All pose detection runs in your browser
- No Data Collection: Camera data never leaves your device
- No Server Required: Fully client-side application
- HTTPS Enforced: Secure camera access protocols
- Open Source: Transparent and auditable codebase
| Metric | Description | Optimal Range | Status |
|---|---|---|---|
| Neck Angle | Head alignment with vertical | 0-15Β° | β Active |
| Trunk Flexion | Spine curvature from vertical | 0-15Β° | β Active |
| Elbow Angle | Upper arm to forearm angle | 90-110Β° | β Active |
| Knee Angle | Thigh to shin angle | 80-110Β° | β Active |
| Pelvic Tilt | Hip alignment deviation | Β±10Β° | β Active |
| Confidence | Landmark detection quality | >80% | β Active |
- Chrome 88+ (Recommended)
- Firefox 85+
- Safari 14+
- Edge 88+
Note: Camera access requires HTTPS in production environments.
This project is licensed under the MIT License - see the LICENSE file for details.
- MediaPipe Team for the excellent pose detection models
- Google for MediaPipe Tasks Vision
- Vercel for Next.js framework
- shadcn for the beautiful UI components
- Radix UI for accessible primitives
For questions, issues, or feature requests:
- Open an issue on GitHub
- Check existing documentation
- Review the code examples in the repository