A script to artificially apply eyeliner on live video (Webcam videos and images also supported)
- We first locate the faces present in an image.
- On each face detected, we locate 68 facial landmark points.
- We extract the points representing eyes (pt no. 37-49) out of those 68 points.
- We interpolate over the extracted eye landmark points to generate a curve.
- We draw over this curve and we have our eyeliner.
lndMrkDetector()
: To extract 68 facial landmark pointsgetEyeLandmarkPts()
: To extract eye landmark points (pt no 37-48)getEyelinerPoints()
: To interpolate those eye landmark pointsdrawEyeliner()
: To draw eyeliner on interpolated points
git clone https://github.com/kaushil24/Artificial-Eyeliner/
- Install the
venv
module:
python3 -m pip install --user virtualenv
- Setup the virtual environment and activate it:
python3 -m venv env
source env/bin/activate
- To install Dlib please visit this article-https://www.pyimagesearch.com/2017/03/27/how-to-install-dlib/
- Rest of the dependencies:
pip3 install -r requirements.txt
python3 eyeliner.py -v "Media/Sample Video.mp4" -s "Output"
python eyeliner.py [-i image] [-v video] [-d dat] [-t thickness] [-c color] [-s save]
-i
: Location of image you want to apply eyeliner on-v
: Location of video you want to apply eyeliner on.-v
: Live eyeliner of webcam video ifwebcam
is given (Eg:python3 -v webcam -s "webcam"
)-t
: Whole interger number to set thickness of eyeliner. Default =2
. Recommended number value between 0-5-d
: Path to yourshape_predictor_68_face_landmarks.dat
file. Default value is the root unless you have theshape_predictor_68_face_landmarks.dat
file stored at some other location you need not use this argument.-c
: Change color of the eyeliner. Use-c 255 255 255
. Defaule =0 0 0
.-s
: Location and file name you want to save the output to. NOTE The program automatically adds extension while saving the file. NOTE: If a file with same name already exists, it will overwrite that file.
- Analyze the results on different eye shapes and color.
- Dynamically change eyeliner thickness based on the distance between subject and camera.
- Add support for people wearing spectacles.
- Python - 3.6
- Numpy - 1.17.4
- Dlib - 19.18.0
- cv2 - 4.1.2
- matplotlib - 3.1.2
- skimage - 0.16.2
- scipy - 1.3.3
- imutils - 0.5.3
- PIL - 6.2.1
Face images ("Sample Image.jpg") generated by AI. https://generated.photos