Face Replace (ft. LamaLisa and LamaGaga)

For this project I decided I wanted to combine image and webcam use by creating a face swap project.
I found a great processing library with many built in computer vision functions that could be used for different applications. Find it here.
I first used OpenCV to get facial recognition working. Here it is – the green circle shows approximately where your face is.
After that, I created a mask image that could be used and resized based on the length and width of the face that is recognized as seen below.
The facial recognition is also used on the image that the user can input into the code. (It works on any image with a clear face shape!)
The face in the image is cropped according to the mask that we created before, and finally the ‘live face’ is overlayed on top using the blend function in processing.
View the source code.