Skip to content

Real-time FaceSwap application built with OpenCV and dlib

License

Notifications You must be signed in to change notification settings

suseyang/FaceSwap

 
 

Repository files navigation

How to run?

OpenCV and dlib are required.

Copy haarcascade_frontalface_default.xml from OpenCV sources/data/haarcascades folder. Download shape_predictor_68_face_landmarks.dat from http://sourceforge.net/projects/dclib/files/dlib/v18.10/shape_predictor_68_face_landmarks.dat.bz2 and place in correct folder.

After that FaceSwap should work.

How does it work?

The algorithm searches until it finds two faces in the frame. Then it estimates facial landmarks using dlib face landmarks. Facial landmarks are used to "cut" the faces out of the frame and to estimate the transformation matrix used to move one face over the other.

The faces are then color corrected using histogram matching and in the end the edges of the faces are feathered and blended in the original frame.

Result

Before...

Before

After...

After

About

Real-time FaceSwap application built with OpenCV and dlib

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 100.0%