This part of the script uses code by Sam Lavigne who is. If you want to go bigger and draw real big things, simply increase the size of the image, so that both layers are increased, too. Then save the Putin as _back.jpg - the naming convention is the only important thing here. Simply draw whatever you want on the top layer, then hide the Putin and save it as _front.png.
I am aware not everyone has or knows how to use photoshop, but if you don’t maybe a friend does? The mask_template.psd can be used to draw your own masks. The logic behind this is explained further below. Both image files NEED TO HAVE THE SAME DIMENSIONS. You see that each mask consists of two files, a reference image containing a face (the more passport style the better) and a transparent png image with the mask. Same idea, the output looks hopefully like this: $ python apply_mask.py -i examples/groups/group1.jpg -m examples/hats -o examples/masked/group_w_hats.jpg Every command can be run with the -h flag as well to show the options. I provided some photos of random people and example masks to play with. Please also check out previous explorations of mine in which I mainly had fun with replacing faces with visually similar ones as retrieved from search engines in real time.Īfter having all the dependencies installed, you can try running some test commands. The foundation of the other script, apply_mask.py is this tutorial. His repo is found slightly modified in the mask_generator directory of this project.
Thanks to Sam Lavigne on whose code the create_mask.py entirely relies. If you are looking for a more faceswap-style-effect this is not what you want.īelow is the logic of the script explained, some Usage Guidelines and some help for installing the dependencies: OpenCV, dlib and Stasm (as tested on OSX). There is two scripts, create_mask.py and apply_mask.py.īe aware, the aesthetic this script is designed to produce is the one known from hand drawn ‘mustache and glasses’ or from old lo-fi paper masks. This is a toolkit for making silly (or not silly) masks and hats and put them on people's faces.