Skip to content
Go to file


Failed to load latest commit information.
Latest commit message
Commit time


This is a terrible hack I made in 6 hours for the TerribleHack hackathon (see other entries), a parody hackathon for making stupid things. See the DevPost submission for more screenshots and explanation.

It uses OpenCV and dlib to perform face pose detection on downloaded Youtube videos and webcam photos. It then uses a triangulation of the detected face points to texture map a picture of your face onto the faces in the video. The face detection is computed beforehand in a C++ program and outpus location data in a JSON file, which is read by a Three.JS web page that renders the video and synchronizes the mapped rendering of a face on top of the video.


Face detection

In the demo, my face is warped over Rick Astley in the "Never gonna give you up" video. The lips of the warped face and the rotation both follow Rick because of the flexible mapping.

How to run

There's a lot of things in the .gitignore file since there's some large data and copy-pasted videos and libraries. Because I was frantically trying to finish it in 6 hours a lot of the paths are hard-coded and there isn't a good linking and resources loading story.

You'll need to do at least the following things:

  • Downoad dlib and put it in the dlib folder, this is because the only good building method for DLib is to include its CMake file in your project and have it compile with your project. :|
  • Put the DLib face model, a photo of yourself, and a video into the res folder for processing.
  • make a build folder, cd into it, and run cmake ..
  • alter all the paths in the source code to work
  • run make, then run ./bin/faceHack, this will process the video and output a JSON file
  • copy the required resources and put them in the web directory and run a simple HTTP server like ruby -run -e httpd . -p 9090
  • visit http://localhost:9090/ to view your video


Replace faces in any video with your own! Made for Terrible Hacks




No releases published
You can’t perform that action at this time.