In this pet project, I use dlib to predict facial landmarks, then extract eyes from face and finally make transform the eyes into special eyes in Naruto anime.
git clone https://github.com/baoanh1310/sharingan.git
cd sharingan
sudo apt-get update
sudo apt-get install build-essential cmake
sudo apt-get install libopenblas-dev liblapack-dev
sudo apt-get install libx11-dev libgtk-3-dev
sudo apt-get install python python-dev python-pip
sudo apt-get install python3 python3-dev python3-pip
mkvirtualenv sharingan -p python3
workon sharingan
pip install -r requirements.txt
python facial_landmarks.py --shape-predictor shape_predictor_68_face_landmarks.dat --image images/sample.jpg
python facial_landmarks_stream.py --shape-predictor shape_predictor_68_face_landmarks.dat
python extract_parts.py --shape-predictor shape_predictor_68_face_landmarks.dat --image images/elon.jpg
python eye_blink_detect.py --shape-predictor shape_predictor_68_face_landmarks.dat
python glasses_effect.py --shape-predictor shape_predictor_68_face_landmarks.dat --image images/elon.jpg --glass images/glasses.png
python glasses_stream.py --shape-predictor shape_predictor_68_face_landmarks.dat --glass images/glasses.png
python sharingan.py --shape-predictor shape_predictor_68_face_landmarks.dat --image images/elon.jpg --eye images/sharingan.png
python sharingan_stream.py --shape-predictor shape_predictor_68_face_landmarks.dat --eye images/sharingan.png
I use this library to detect face, facial landmarks and extract face parts.
If you really want to know the details in the libraries or functions in my code, I recommend you read the following papers:
-
One millisecond face alignment with an ensemble of regression trees: https://bit.ly/2RPUwtD
-
Real-Time Eye Blink Detection Using Facial Landmarks: https://bit.ly/3bmdqzV