Paper written on this is available here: http://www.syzible.com/snapchat-filter
3 filters for CS7434 augmented reality - face swap, glasses and moustache
Clone the repo and create a directory in it called "resources". In this, you need the pre-trained face data available here: http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
Download and extract this to "resources/landmark_predictor.dat"
In resources, place any images you want to use in it for filters (face swap images, moustache image, glasses image, etc); modify the code as appropriate.
Make sure you have Python 3 installed, see here for easy installation with Brew on OSX http://www.pyimagesearch.com/2016/12/19/install-opencv-3-on-macos-with-homebrew-the-easy-way/
Also make sure you have pip installed with the libraries dlib and numpy. Install any others as required.
If you want to create bug fixes or extend functionality, feel free to send pull requests.