GrammerT / Virtual-Makeup

Python, OpenCV based virtual try on for makeup (lip colour, blush, foundation prolly eyewear too) no not eye-wear

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. Clone this repository
  2. Create a virtual environment using python3 -m venv env or anyother way of creating virtual envs
  3. Install the requirements using pip install -r requirements.txt
  4. 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 Image Light Pink blush applied
Original Sample Lip Color applied
Original Image Image with Lip color applied
Original Sample Foundation applied
Original Image image

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)

About

Python, OpenCV based virtual try on for makeup (lip colour, blush, foundation prolly eyewear too) no not eye-wear


Languages

Language:Python 100.0%