GithubHelp home page GithubHelp logo

pkthebud / facehack Goto Github PK

View Code? Open in Web Editor NEW

This project forked from trishume/facehack

0.0 1.0 0.0 300 KB

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

License: MIT License

CMake 2.10% Shell 0.21% C 8.90% C++ 27.69% HTML 61.10%

facehack's Introduction

FaceHack

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.

Gif

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

facehack's People

Contributors

trishume avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.