An AI-powered virtual dressing room experience using real-time pose detection
Live Demo β’ Report Bug β’ Request Feature
Project Name: Digital Mirror - Virtual Try-On System
Developer: P G AYUSH RAI (majen)
Institution: Vidyavardhaka College of Engineering (VVCE)
Build Date: 2024
Project Type: Web-based Virtual Try-On Application
Version: 1.0.0
Digital Mirror is an innovative web-based virtual try-on system that allows users to visualize clothing items (shirts and pants) on themselves in real-time using their webcam. The application leverages MediaPipe Pose Detection to track body landmarks and overlay clothing images accurately on the user's body, creating an immersive virtual dressing experience.
β¨ Real-time Pose Detection - Uses MediaPipe AI to detect and track body landmarks
π Virtual Clothing Overlay - Dynamically overlays shirts and pants on detected body positions
π± Webcam Integration - Supports both built-in and external webcams (including DroidCam)
π¨ Interactive Selection - Choose from multiple clothing options with visual preview
β‘ Instant Visualization - See how clothes fit in real-time with smooth rendering
π Reset Functionality - Easily switch between different clothing items
- HTML5 - Structure and markup
- CSS3 - Styling and responsive design
- JavaScript (ES6+) - Core application logic
- MediaPipe Pose - AI-powered pose detection and body landmark tracking
- Canvas API - Real-time image rendering and overlay
- WebRTC - Webcam access and video streaming
CodeBreakers-vvce/
β
βββ index.html # Landing page with project introduction
βββ index1.html # Main try-on interface
βββ script1.js # Core JavaScript logic for pose detection & overlay
βββ styles.css # Landing page styles
βββ styles1.css # Try-on interface styles
β
βββ background.jpg # Background image for landing page
βββ vvcelogo.jpg # College logo
β
βββ s01-removebg-preview.png # Shirt option 1
βββ shirtt-removebg-preview.png # Shirt option 2
βββ i1-removebg-preview.png # Pants option 1
βββ i2-removebg-preview.png # Pants option 2
βββ i3-removebg-preview.png # Pants option 3
β
βββ DroidCam.Setup.6.5.2.exe # DroidCam installer for mobile webcam
βββ README.md # Project documentation
- Modern web browser (Chrome, Firefox, Edge, Safari)
- Webcam (built-in or external)
- Internet connection (for MediaPipe CDN)
-
Clone the repository
git clone https://github.com/Majenayu/CodeBreakers-vvce.git cd CodeBreakers-vvce -
Launch the application
- Simply open
index.htmlin your web browser - Or use a local server:
# Using Python python -m http.server 8000 # Using Node.js npx http-server
- Simply open
-
Optional: Set up DroidCam (for mobile webcam)
- Install DroidCam on your Android phone (from Play Store)
- Run
DroidCam.Setup.6.5.2.exeon your PC - Connect your phone and PC on the same network
- Launch DroidCam on both devices
-
Start the Application
- Open
index.htmlin your browser - Click "Start the Process" button
- Open
-
Grant Webcam Access
- When prompted, allow webcam access
- Your live video feed will appear on screen
-
Choose Clothing Type
- Click "Shirt" to browse shirt options
- Click "Pants" to browse pants options
-
Select Your Style
- Click on any clothing item to preview
- Selected item will be highlighted
-
Try It On
- Click the "Try" button
- Stand in front of the camera
- The clothing will overlay on your body in real-time
-
Switch Items
- Click "Reset" to clear the current selection
- Choose a different clothing item and try again
-
Pose Detection Pipeline
Webcam Feed β MediaPipe Pose β Landmark Detection β Canvas Rendering -
Body Landmark Tracking
- Detects 33 body landmarks using MediaPipe
- Tracks shoulders (landmarks 11, 12) for shirt positioning
- Tracks hips (landmarks 23, 24) for pants positioning
-
Dynamic Overlay Calculation
- Calculates clothing dimensions based on body proportions
- Adjusts scale and position in real-time
- Maintains aspect ratio for natural appearance
-
Rendering Process
- Captures video frame from webcam
- Processes frame through pose detection
- Overlays clothing image on canvas
- Repeats at video framerate for smooth experience
- Prepare your clothing image (PNG with transparent background)
- Add image file to project directory
- Update
clothingItemsobject inscript1.js:const clothingItems = { shirt3: 'path/to/your/new-shirt.png', pants4: 'path/to/your/new-pants.png', };
Modify scaling factors in script1.js:
// For shirts
const shirtWidth = Math.abs(rightShoulder.x - leftShoulder.x) * canvasElement.width * 2 * 0.9;
// For pants
const pantsWidth = Math.abs(rightHip.x - leftHip.x) * canvasElement.width * 1 * 3.9;If using your smartphone as a webcam:
- Download DroidCam from Google Play Store
- Install
DroidCam.Setup.6.5.2.exeon your PC - Connect both devices to the same Wi-Fi network
- Launch DroidCam on phone and note the IP address
- Enter the IP in DroidCam Client on PC
- Click "Start" to use your phone as webcam
Experience the virtual try-on system live:
https://codebreakers-vvce.onrender.com/
- Requires good lighting for accurate pose detection
- Best results with solid background
- Clothing overlay may need adjustment based on camera angle
- Local file paths in
script1.jsneed updating for production use
- Add more clothing categories (jackets, accessories)
- Implement color customization
- Add size recommendations based on body measurements
- Support for multiple users simultaneously
- Save and share try-on screenshots
- Mobile-responsive design
- 3D clothing models for better realism
Contributions are welcome! To contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is part of an academic initiative at Vidyavardhaka College of Engineering.
For licensing inquiries, please contact the developer.
P G AYUSH RAI (majen)
- GitHub: @Majenayu
- Institution: Vidyavardhaka College of Engineering (VVCE)
- MediaPipe - For the pose detection library
- Vidyavardhaka College of Engineering - For project support
- DroidCam - For mobile webcam solution
- CodeBreakers Team - For collaboration and testing
For issues, questions, or suggestions:
- Open an Issue
- Contact: P G AYUSH RAI (majen)
Made with β€οΈ by P G AYUSH RAI (majen)
β Star this repository if you find it helpful!