Implementation of Digital face makeup by example with the following modifications -
- Face key point detector is
dlib
's implementation with 69 points. Forehead points are manually adjustable and automatically added first using 3rd party skin detector implementation - Bilateral filtering is used instead of weighted-least-square (WLS)
- XDoG of subject along with makeup is displayed. weighted sum of LAB values is taken.
-
Install required dependencies using
pip install -r requirements.txt
-
Place
shape_predictor_68_face_landmarks.dat
in src directory in not already there. You can download it from dlib official site -
The program takes two inputs (i.e. Subject Image nd Example Image) and can be run as -
python digital_makeup.py -lc -lf input/subject1.png input/example1.png
-
The program has option for 3 flags:
-si
or show interactive to display output of intermediary steps like face alignment and various face masks extraction- The other two flags
-lc
and-lf
which imply:-lf
or light foundation. Skin details aren’t hidden when foundation is light. Weight of subjects’ for transferring skin detail (δI ) is 1 instead of 0-lc
or light makeup color. Weight while doing color transfer are more in favor of subject image, γ = 0.5 instead of γ = 0.8 or weight of subject color 0.5 instead of 0.2
The entire process can be broken into following steps -
- Face Alignment
- Layer Decomposition
- Skin Detail Transfer
- Color Transfer
- Highlight and Shading Transfer
- Lip Makeup
(To understand the complete approach of the Design go through - Report)
digital_makeup.py
- Main py file, provides command line interface to call the entire digital makeup transfer process
src/face_alignment.py
- Face landmark points extraction
- Face Warping
- Face mask extraction for various components - skin, lips, eyes, mouth
src/makeup_util.py
- Layer Decomposition
- Color and Detail Transfer
- Highlight and Shading Transfer
- Lip makeup special function
src/xdog.py
- Cartoonize an image, black and white output
src/skin_detector.py
- Skin detection for face used in automatic detection of forehead points
input
- Contains image files to test code with
output
- Output of some experiment on input images