Virtual-Makeup
Virtual-Makeup copied to clipboard
Python, OpenCV based virtual try on for makeup (lip colour, blush, foundation prolly eyewear too) no not eye-wear
Virtual-Makeup
Python, OpenCV based virtual tryon for makeup lip-color, blush, foundation ~~and prolly eyewear too~~
These python scripts add "make up" on to an input. The input is either a static image of a person's face or live webcam feed.
Currently only lipcolor and face blush is supported and the color of defaults to rgb(157, 0, 153)
but it can be changed.
How to use
- Clone this repository
- Create a virtual environment using
python3 -m venv env
or anyother way of creating virtual envs - Install the requirements using
pip install -r requirements.txt
- To try the makeup process on the included model.jpg comment out the video capture code and uncomment the static image code and run
python main.py
Sample outputs from ths implementation
Original Sample | Blush Applied |
---|---|
![]() |
![]() |
Original Sample | Lip Color applied |
---|---|
![]() |
![]() |
Original Sample | Foundation applied |
---|---|
![]() |
![]() |
How it works
Using mediapipe I detect 468 facial landmarks and and pull out the required landmarks (lips and cheek landmarks) and after that I use simple image processing techniques to achieve the end result
File structure
main.py
-> Primary file, reads the input image and applies the makeup
api.py
-> Contains the fastapi endpoints
landmarks.py
-> Contains all the functionality for the landmarks (detection, normalization etc)
sample.py
-> A sample script that uses python-requests
to demonstrate the endpoints
utils.py
-> Contains utility functions.
Fast API
Provides openapi spec by default, run using uvicorn api:app
and navigate to localhost:8000/docs to view the openapi spec or to localhost:8000/redoc to view the redoc spec. Currently two API Endpoints are supported apply-makeup
and apply-feature
(Needs Fix, doesn't work as of now)