Skip to content

PR resolves #11 #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
362 changes: 362 additions & 0 deletions FacialFeatureDetection/FacialFeaturesDetection.ipynb

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions FacialFeatureDetection/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Facial Feature Detection

## About Project
In this project, I am making use dlib library and OpenCV to mimic the facial filters like Snapchat or Instagram. In today's time, facial filters have garnered immense popularity amongst the millennials and Gen-Z alike.

Currently, the project supports basic filter props such as moustache, funny eyes and santa claus. But the possibilities of different facial filters are endless.

## Implementation

I have used pretrained weights to predict the facial landmarks of the person(s) on the live webcam. Dlib library is used to load these weights and make the prediction.

Please refer to the picture below for the different facial landmarks that can be predicted using ```shape_predictor_68_face_landmarks.dat``` file.

![img](https://camo.githubusercontent.com/04da00a85d1bb8f8aaeca0da27cccad8d63674896f8b858d60759bb3af98d25e/68747470733a2f2f63646e2d696d616765732d312e6d656469756d2e636f6d2f6d61782f313630302f312a393655542d44387553586a6c6e79767339445a546f672e706e67)

Once the landmarks are identified, I am using OpenCV to load the filter props, resize them based on the size of face and then, superimpose them over the live-streaming frame for filter like effect.

Filter to be applied is selected using function argument.
Binary file added FacialFeatureDetection/filters/beard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FacialFeatureDetection/filters/eye.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FacialFeatureDetection/filters/moustache.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FacialFeatureDetection/filters/moustache_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FacialFeatureDetection/filters/mustache.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FacialFeatureDetection/filters/santa-cap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FacialFeatureDetection/filters/sunglasses_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FacialFeatureDetection/filters/sunglasses_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
4 changes: 4 additions & 0 deletions FacialFeatureDetection/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
opencv-python==4.1.1.26
numpy==1.19.2
dlib==19.18.0
scipy==1.4.1