--- title: Virtual Try-On App emoji: 👕 colorFrom: blue colorTo: green sdk: docker app_port: 8000 pinned: false --- # Advanced Virtual Try-On A web-based virtual try-on application that allows users to try on clothing virtually using their webcam. Built with Python, OpenCV, and Shiny. ## Features - Real-time virtual try-on using webcam - Support for transparent background garment images - Adjustable garment fitting parameters - Multiple UI modes (Shiny web interface, Tkinter desktop app) - Docker support for easy deployment ## Prerequisites - Python 3.9 or higher - Docker and Docker Compose (for containerized deployment) - Webcam - OpenPose models (will be downloaded automatically on first run) ## Installation ### Local Development 1. Clone the repository: ```bash git clone cd virtual-tryon ``` 2. Create a virtual environment and activate it: ```bash python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ``` 3. Install dependencies: ```bash pip install -r requirements.txt ``` ### Docker Deployment 1. Build and run using Docker Compose: ```bash docker-compose up --build ``` The application will be available at http://localhost:8000 ## Usage ### Web Interface (Shiny) 1. Start the application: ```bash python app.py --shiny ``` 2. Open your web browser and navigate to http://localhost:8000 3. Upload a garment image with transparent background 4. Click "Start Try-On" to begin the virtual try-on session 5. Adjust the garment fit using the sliders: - Width Scale: Adjust the width of the garment - Height Scale: Adjust the height of the garment - Collar Position: Adjust the vertical position of the garment - Show Skeleton: Toggle the display of pose estimation skeleton ### Desktop Application (Tkinter) 1. Start the application: ```bash python app.py --tkinter ``` 2. Use the GUI controls to upload a garment and adjust parameters ### Command Line Mode 1. Run with a specific garment: ```bash python app.py --garment path/to/garment.png ``` ## Directory Structure - `models/`: Directory for storing OpenPose models - `temp/`: Directory for temporary files - `app.py`: Main application file - `requirements.txt`: Python dependencies - `Dockerfile`: Container configuration - `docker-compose.yml`: Docker Compose configuration ## Troubleshooting 1. Webcam not detected: - Ensure your webcam is properly connected - Check if the webcam is being used by another application - For Docker deployment, ensure proper device access is configured 2. Garment not displaying correctly: - Use images with transparent backgrounds (PNG format recommended) - Ensure the garment image is not too large or too small - Try adjusting the width and height scales 3. Performance issues: - Reduce the camera resolution - Close other resource-intensive applications - For Docker deployment, ensure proper resource allocation ## License This project is licensed under the MIT License - see the LICENSE file for details.