Jayanths9 / Virtual_Makeup

Transform facial images with virtual makeup using Python, OpenCV, and MediaPipe. This script enables real-time application of lipstick, eye shadow, eyebrow color, and eyeliner based on facial landmarks. Ideal for experimenting with different makeup styles using video, image, or live camera inputs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Virtual Makeup Using Mediapipe

Clone and Run

git clone https://github.com/Jayanths9/Virtual_Makeup_opencv.git
cd Virtual_Makeup_opencv
conda env create -f environment.yml
conda activate virtual_makeup

Run on Camera input

python camera.py

Run on sample image

python image.py --image sample/face.png

Introduction

In this project Mediapipe [1] facial landmarks and opencv is used to add makeup on facial features.

  • Mediapipe facial landmark library detects the face in the image and returns 478 landmarks on human face. (x,y) coordinates of each points is obtained w.r.t the image size.

Landmarks image
Media pipe facial landmarks example [2]

  • From all the facial landmarks, extract Lips, Eyebrow, Eyeliner & Eyeshadow points and create a colored mask with respect to the input image.

mask
Colored Mask for Lips, Eyebrow, Eyeliner & Eyeshadow

  • Blend the Original image and the mask with respect to its weights to add makeup on the original image.

mask
Original image and Transformed Image with Makeup [3]

  • Virtual Makeup on video.

Watch the video
Virtal makeup on video [4]

Refrences

  1. https://ai.google.dev/edge/mediapipe/solutions/vision/face_landmarker
  2. https://medium.com/@hotakoma/mediapipe-landmark-face-hand-pose-sequence-number-list-view-778364d6c414
  3. https://i.pinimg.com/originals/a9/93/7d/a9937d95f962f477c486d701a5152752.jpg
  4. https://www.pexels.com/video/attractive-woman-looking-at-the-camera-7048981/

Author: Jayanth S universitat Bremen, Bremen

About

Transform facial images with virtual makeup using Python, OpenCV, and MediaPipe. This script enables real-time application of lipstick, eye shadow, eyebrow color, and eyeliner based on facial landmarks. Ideal for experimenting with different makeup styles using video, image, or live camera inputs.


Languages

Language:Python 100.0%