Creative Coding: Face/Off, an ill-conceived tribute
The action movie, Face/Off, was released in North America in June 1997. John Travolta plays an FBI agent who surgically swaps faces with a terrorist played by Nicholas Cage for… reasons. It features the classic villainous line:
l'd like to take his... his face... off.
In honor of the movie’s 28 year anniversary, I coded a surgery-free face/off tool using the ML5.js Face Mesh machine-learning model. It analyzes all human faces in an image or webcam video and maps a mesh of triangles covering all the landmarks.
I can then take the image pixels from each triangle and copy, stretch and skew them onto the mesh of the other face. I started with still images such as the famous painting, American Gothic:
Using webcam video, you can swap faces with a friend in real time. You simply sit beside each other in front of the camera and hilarity ensues. In my case, my good friend Nicholas Cage wasn’t available in person so I used a photo of him on my phone.
The webcam project is available for you to try out with a friend at https://editor.p5js.org/bcnr/full/NbzN-gfPn. But as mentioned in the headline, this is an ill-conceived project for the following reasons:
It looks bad. It evokes a particularly gruesome scene from the Silence of the Lambs more so than Face/Off.
In this world of “deep fakes,” it isn’t ethical to be digitally impersonating celebrities. Luckily this project wouldn’t fool anyone.
If the skin tones of the two participants differ, you may inadvertently create a politically incorrect situation.
With those caveats, it is good for some laughs with a friend or family member. Enjoy!