Project 1, part 2 feature apply Eye-Liners
#
Feature 2 Apply Eye-Liners or Eye-Lashes
I
decided to draw the upper contour of the eye with a tail towars the ear. I can
change the color of the eyeliner.
To get
this goal, I create a contour outside the eye, later I fill up this contour
with white and make a mask of three channels, I change the color of this mask
with the color of the eyeliner, this array will be the foreground for the process
of alpha blending.
I run
the program in my system, testing several approaches:
The
first part of this project is the same as in Project 1, part 1, apply lipstick:
.- First import libraries
.- import and setup the matplotlib with some parameters
.- mount the drive to access the files
.- load faceBlendCommon.py
.- Load landmark detector
.- Read Image
.- Calculate Landmarks
We read
the image im from disk, we get a copy image2 from it, we can get the landmarks
parts of the left eye and right eye
# Copy im in image2, the work image
# initialize
mask4 to zero
# find
the center of the coordinates of the left eye
# list of values that dictate the extrapolate quantity of the upper points of the eyes
# create np arrays to save the points of the contour of the eye liners
# fill up the array linerLeft with the points near the left eye
# calculate and fill the array linerLeft up with the points far away from the left eye
# create the empty list puntos8 and fill it up to keep the points that were in linerLeft
# plot the contour puntos8 with white color on the mask
# right eye
# fill
up the array linerRight with the points near the right eye
# calculate and fill the array linerRight up with the points far away from the right eye
# create the empty list puntos9 and fill it up to keep the points that were in linerRight
# plot the contour puntos9 with white color on the mask
# create the foreground array
# assign color to eyeliner
# get alpha array with 3 channels from mask4
# copy im to background
# Perform alpha blending
#
Convert float to uint8
# change color space and show outImage as lipsRGB in plt