A browser-based virtual try-on system that explores two different approaches to body tracking:
- 🎯 Pose Estimation (ml5.js / BlazePose) for accessories
- 🧩 Body Segmentation (TensorFlow BodyPix) for clothing
This project demonstrates how different computer vision techniques can be used for real-time augmented reality in the browser.
- Try on multiple glasses styles
- Add earrings dynamically
- Real-time face tracking
- Rotation-aware placement
- Overlay t-shirts and pants
- Uses body segmentation for placement
- Works on full body (upper + lower)
- Live webcam integration
- Runs fully in browser (no backend)
- p5.js – Canvas rendering & interaction
- ml5.js (BlazePose) – Pose estimation
- TensorFlow.js – ML runtime
- BodyPix – Body segmentation model
POSENET/
│── README.md
│
├── face-accessories/ # Pose-based (ml5)
│ ├── index.html
│ ├── sketch.js
│ └── images/
│ ├── specs.png
│ ├── specs2.png
│ ├── specs3.png
│ ├── specs4.png
│ ├── earring.png
│ ├── earring1.png
│ └── earring2.png
│
├── virtual-tryon/ # BodyPix-based
│ ├── try.html
│ ├── try.js
│ └── images/
│ ├── tshirt.png
│ ├── tshirt2.png
│ └── jeans.png
📂 Path: face-accessories/index.html
- Detects key facial points (eyes, ears)
- Places glasses and earrings using coordinates
- Lightweight and fast
📂 Path: virtual-tryon/try.html
- Segments the human body from background
- Uses shoulder & hip positions for clothing placement
- More advanced, but heavier than pose estimation
-
Open project in VS Code
-
Install Live Server extension
-
Run either:
face-accessories/index.htmlvirtual-tryon/try.html
Open in browser:
face-accessories/index.html
or
virtual-tryon/try.html
-
Uses keypoints like:
- eyes → glasses placement
- ears → earrings placement
-
Calculates:
- distance → scaling
- angle → rotation
-
Uses BodyPix to detect body regions
-
Extracts:
- shoulders
- hips
-
Overlays clothing based on bounding positions
- Next Glasses → Switch styles
- Next Earring → Switch styles
- Works best with good lighting
- Accuracy depends on camera quality
- Single-person detection only
- Clothing overlay is approximate (no cloth physics)
- Merge both systems into a single UI
- Improve clothing fit using mesh warping
- Add outfit selection panel
- Mobile optimization
- Multi-person tracking