CS 194-26: Image Manipulation and Computational Photography, Fall 2018

Project 4: Face Morphing

Joseph Reid, cs194-26-aes



Overview

In this project, we morph faces into other faces. However, this involves more than simply fading one image into another because the edges would not line up. By selecting corresponding points on 2 images, you can "warp" these points into each other, giving the illusion of the edge moving with it. Then, depending on which image is more prevalent in a frame, you can linearly interpolate from the source images and take a weighted average of the colors at those points.

Given a dataset of faces, one can also compute an "average" of all faces by warping them into a common shape and then cross-dissolving the colors from these separate images. You can then warp other faces into this average face shape, or, with a slight tweak of parameters, create a caricature of a face.

Defining Correspondences

Usage


    
python define_correspondences.py [path to image1] [path to image2]

Method


    First, using ginput() I select keypoints on the first image in important places for the morph (e.g. eyes, eyebrows, nose, mouse, edge of the face). Then, in the same way with a consistent ordering, I select corresponding keypoints on the second image. These points will transform to each other in the morph, and are the vertices of the triangulation. Then, I run the Delaunay triangulation algorithm on the averaged points using delaunay. The result is show below, though it shows the face upside-down.
  

Delaunay triangulation of the averaged keypoints

Computing the "Mid-way Face"

Usage


    
python define_correspondences.py [path to image1] [path to image2]

Results

Joe
Julie
Mid-way face

The Morph Sequence

Usage


    
python define_correspondences.py [path to image1] [path to image2]

Results

Morph

The "Mean Face" of a population

Usage


    
python mean_shape.py

python mean_face.py

python face_onto_geometry.py

Results

Delaunay triangulation of the average face shape (upside-down)
Person 1
Person 1 morphed to the average face shape
Person 8
Person 8 morphed to the average face shape
Person 31
Person 31 morphed to the average face shape
Average face
My face morphed onto the average face shape
The average face morphed onto my face shape

Caricatures: Extrapolating from the mean

Usage


    
python face_onto_geometry.py

Results

Caricature of my face with
alpha = -0.2