Skip to content

GantMan/Artificial-Eyeliner

 
 

Repository files navigation

Artificial-Eyeliner

A script to artificially apply eyeliner on live video (Webcam videos and images also supported)

Demo:

Before

After


Project Structure:

Flow Chart:

Project Explaination:

  • 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.

Code Overview:

  • lndMrkDetector() : To extract 68 facial landmark points
  • getEyeLandmarkPts() : To extract eye landmark points (pt no 37-48)
  • getEyelinerPoints() : To interpolate those eye landmark points
  • drawEyeliner(): To draw eyeliner on interpolated points

Getting Started:

Clone the repo using:

git clone https://github.com/kaushil24/Artificial-Eyeliner/

Starting virtual environment:

  • 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

Installing the dependencies:

Sample Test:

python3 eyeliner.py -v "Media/Sample Video.mp4" -s "Output"


CLI Usage

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 if webcam 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 your shape_predictor_68_face_landmarks.dat file. Default value is the root unless you have the shape_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.

To Do:

  • 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.

Pull requests are always welcomed :D

Version Info:

  • 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

Credits:

Face images ("Sample Image.jpg") generated by AI. https://generated.photos

About

Script to apply artificial eyeliner

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%