This is the code behind the Switching Eds blog post packaged as a command-line utility.
This is in apprehensive development, and setup goes as follows:
- Install OpenCV with Python bindings on your system. My Debian-based
experience is
sudo apt-get install opencv-python
. I don't know how to pull this into Python setuptools, or if that's wise. As this is unstable, I recommend virtualenv --pip install python-virtualenv
. - Clone this repo. For future reference, let's say you cloned to
~/faceswap
. - Form the training set with
make -C faceswap/data
. This ought to download a large landmarks file and decompress it (I don't think I can re-distribute it). Expect 100MB or more. - Decide on a working directory for python development. Say,
~/faceswap-dev
, and begin withvirtualenv --python=python2.7 ~/faceswap-dev
- Switch to this directory and into the virtualenv with
. bin/activate
. - Install from your clone directory
pip install -e ~/faceswap
. - The command-line utility faceswap will appear in your path.
faceswap <head image> <face image>
If successful, a file output.jpg
will be produced with the facial features
from <head image>
replaced with the facial features from <face image>
.