CS194-26 Computational Photography Final Project, based off of the SIGGRAPH paper "Style Transfer for Headshot Portraits"
Website: https://jchavezberkeley.github.io/PortraitStyleTransfer/
Written by Jose Chavez and Daniel Li
Link to paper Link to OpenCV/dlib program for automatically finding correspondence points
To be able to run this code, please make an images/
and a points/
folder in your directory with the following python files. Arguments passed in will look for images and data in these folders.
This file opens up each image, using ginput
and allows to click and select locations for correspondence points.
Arguments:
- Name of first image to choose points on. Do not include file extension.
- Name of second image to choose points on. Do not include file extension.
- Number of points to be selected on each image.
Example: python3 ./inputs.py jose george 43
Outputs:
- Saves the data from the points into
.txt
, placed in thepoints/
folder.
This file opens up an image and allows you to draw and save a binary mask. The code written in this file is not our own. The instructions to use this code is found here
Arguments:
- Entire path of image to draw mask around
Example: python3 ./make_mask.py ./jose.jpg
This file contains all commonly used functions. They mostly deal with using skimage, specific numpy operations, functions to make Laplacian and Gaussian stacks, and our warping function.
This file contains out algorithm for style transfer. Time of execution is approximately 4 minutes with image being of size 602x750.
Arguments:
- Name of input image, the image to have style transfer to it. Do not include the file extension, please put this image in
images/
folder. - Name of example image, the image to transfer style from. Do not include the file extension, please put this image in
images/
folder. - Boolean value, either True or False, on whether you want result to be in grayscale.
- Boolean value, either True or False, on whether you want to use binary mask in the Laplacian stacks
- Boolean value, either True or False, on whether you want to use correspondences found manually
- Name of file to be outputted. Do not include extension.
Example: python3 ./main.py jose george false true false jose_george_test