{"id":21864138,"url":"https://github.com/parneet-sandhu/virtual-try-on","last_synced_at":"2026-01-19T04:32:50.463Z","repository":{"id":262601257,"uuid":"887764686","full_name":"Parneet-Sandhu/Virtual-Try-On","owner":"Parneet-Sandhu","description":"This project uses OpenCV, Mediapipe, and NumPy to create an interactive virtual try-on experience. The application overlays a virtual accessory (e.g., glasses) onto the user's face using webcam input and allows users to control the brightness of the camera feed and capture screenshots using hand gestures.","archived":false,"fork":false,"pushed_at":"2024-11-13T14:13:06.000Z","size":453,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T19:46:42.512Z","etag":null,"topics":["computer-vision","mediapipe","numpy","opencv","python","tkinter"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Parneet-Sandhu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-13T08:45:09.000Z","updated_at":"2025-01-14T08:50:44.000Z","dependencies_parsed_at":"2024-11-13T10:18:45.243Z","dependency_job_id":"4a393a53-56c5-41c9-82a0-6512a847e9bb","html_url":"https://github.com/Parneet-Sandhu/Virtual-Try-On","commit_stats":null,"previous_names":["parneet-sandhu/virtual-try-on"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Parneet-Sandhu%2FVirtual-Try-On","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Parneet-Sandhu%2FVirtual-Try-On/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Parneet-Sandhu%2FVirtual-Try-On/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Parneet-Sandhu%2FVirtual-Try-On/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Parneet-Sandhu","download_url":"https://codeload.github.com/Parneet-Sandhu/Virtual-Try-On/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393542,"owners_count":20931810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-vision","mediapipe","numpy","opencv","python","tkinter"],"created_at":"2024-11-28T04:07:36.518Z","updated_at":"2026-01-19T04:32:50.436Z","avatar_url":"https://github.com/Parneet-Sandhu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Virtual Try-On Project\n\nThis project uses **OpenCV**, **Mediapipe**, and **NumPy** to create an interactive virtual try-on experience. The application overlays a virtual accessory (e.g., glasses) onto the user's face using webcam input and allows users to control the brightness of the camera feed and capture screenshots using hand gestures.\n\n## Features\n\n- **Virtual Accessory Placement**: Automatically places a virtual accessory (such as glasses) on the user's face, aligned with their eyes.\n- **Brightness Control**: Use hand gestures to adjust the brightness of the live video feed.\n- **Screenshot Capture**: Capture a screenshot by performing a thumbs-up gesture with the left hand.\n- **Real-Time Interaction**: Live webcam feed with real-time adjustments and accessory placement.\n- **Accessory Customization**: Load and apply custom accessories (PNG images with an alpha channel) from a folder.\n\n## Requirements\n\n- **Python 3.x** (Tested on Python 3.7 and above)\n- **OpenCV**: For webcam feed and image processing\n- **Mediapipe**: For face and hand landmark detection\n- **NumPy**: For numerical operations and image manipulation\n- **Tkinter**: For the user interface to apply accessories\n\nTo install the required dependencies, you can use the following `pip` command:\n\n```bash\npip install opencv-python mediapipe numpy\n```\n## Assets Folder\nThe project relies on an accessory image (e.g., glasses or mask) that should be placed inside the  `assets` folder.\n- assets/mask.png: This is the virtual accessory image used for the try-on. You can replace it with any image (e.g., glasses, hats) that has a transparent background (alpha channel).\n\n## Running the Application\nTo run the application, simply execute the `main.py` file:\n```bash\npython main.py\n```\nThe webcam will open, and the system will start processing the video feed. The virtual accessory will be placed on the user's face in real-time, and hand gestures will control brightness and allow for screenshot capture.\n\n- Right Hand: Adjusts brightness by controlling the distance between the thumb and index finger.\n- Left Hand: Captures a screenshot when a thumbs-up gesture is detected.\n\nPress 'q' to exit the program.\n\n## How It Works\n- **Face Landmark Detection**: The program uses Mediapipe’s FaceMesh solution to detect face landmarks, particularly the eyes, to position the virtual accessory.\n- **Hand Landmark Detection**: The program uses Mediapipe’s Hands solution to track the user's hand movements. The right hand controls brightness, and the left hand triggers screenshots with a thumbs-up gesture.\n- **Accessory Placement**: The accessory image is resized based on the distance between the user's eyes and overlaid on the webcam feed. Transparency is respected using the alpha channel of the accessory image.\n- **Brightness Control**:The right hand’s thumb and index finger distance is used to control the brightness of the video feed in real time.\n- **Screenshot Functionality**: When the left hand forms a thumbs-up gesture, a screenshot is taken and saved with a timestamped filename.\n\n## Working Demo:\n![Screenshot 2024-11-13 194320](https://github.com/user-attachments/assets/c2f3637d-5379-4d59-929d-0628ee4411fe)\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparneet-sandhu%2Fvirtual-try-on","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparneet-sandhu%2Fvirtual-try-on","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparneet-sandhu%2Fvirtual-try-on/lists"}