CS 280A Project 3 Report

James Peng

1. Defining Correspondences

I defined the corresponding points of images with the provided labeling tool. After labeling, four corner corresponding points were manually added. Then, I generated the triangulation by the Delaunay triangulation algorithm. Below are my images.

imageAimageB
source imagetarget image
source_facetarget_face
source image with triangulationtarget image with triangulation

2. Computing the "Mid-way Face"

Computing the mid-way face involves three steps. The first step is to compute the average shape of two images. It could be completed by simply averaging the corresponding points' coordinates. Let the source image be Isrc , the target image be Itgt , the corresponding points of the source image be Psrc and the corresponding points of the target image be Ptgt.

Pavg=Psrc+Ptgt2

After obtaining Pavg , I applied the Delaunay algorithm on it to get the mid-way face's triangulation.

The second step is to warp both Isrc and Itgt into average shape using Pavg . Nextly, we need to compute the affine transform matrix M such that Mpsrc=pmid for each triangle, where psrc and pmid are triangles (three vertices, of course) in Psrc and Pmid. Rewrite it into matrix form, we have:

[abcdef001][px1px2px3py1py2py3111]=[qx1qx2qx3qy1qy2qy3111]

Notice that it is equivalent to:

[px1py11000000px1py11px2py21000000px2py21px3py31000000px3py31][abcdef]=[qx1qy1qx2qy2qx3qy3]

By solving this equation, I obtained M. Therefore, M1 can be computed and used for inverse warping (with bi-linear interpolation).

Similarly, we can find M1 such that M1pmid=ptgt for each triangle as well.

Finally, the third step is averaging the color from two warped image.

The result is shown below:

imageAmidfaceimageB
source imagemid-way facetarget image

3. The Morph Sequence

We can generate the morphing sequence with different warp fraction and dissolve fraction in the interval [0, 1]. In fact, mid-way face is a special case of morphing sequences with both warp fraction and dissolve fraction equal to 12.

 

mymorph2

4. The "Mean face" of a population

I used the Dane dataset and computed the mean face for the male. There are 33 males images in the dataset.avg_male_face

Though the facial features of the mean face are clear, the hair was quite blurry. It is possibly because the Dane dataset annotate most of the corresponding points on the face, and there are no corresponding points on the hair.

Dane_sample
There is no corresponding point on hair.

This results in when warping images into mean shape, while the facial features are transformed, their hair positions remain, leading to strange outcomes.

Below are some examples that transform the male faces into mean shape. The left column are the original image, and the right column are the images after transformations. The last raw is the photo of myself.

warp_sample-1warp_to_avg-1
warp_sample-3warp_to_avg-3
warp_sample-6warp_to_avg-6
warp_sample-13warp_to_avg-13
warp_sample-18warp_to_avg-18
me_Daneme2avg

5. Extrapolating from the mean

I did the extrapolation by setting the warp fraction to 1.5 and 0.5 .

me2extraavgme2faravg
warp fraction = 1.5,
a "very mean shape"
warp fraction = 0.5,
a "very not mean shape"

Bells and Whistles: PCA analysis

I did the PCA analysis on Dane dataset's male faces. The mean face and the top 15 principle components are shown below:

pca_grid

We can find that for the most important components, they captured the more "general" features while the less important components captured more "specific" details. I pixel-wised did the weighted average between the mean face and the first principle component and got the following image:

mean_with_principle