Reconstruction Module

As explained in [PCA Reconstruction](home) we need a flattened feature vector to able to build a PCA Model. This holds for both shape and texture model. Currently we implement the independent AAM model where we keep the feature vector separate. Note that we could also choose to combine the shape and appearance in a single flattened feature vector (TODO: elaborate our choice more about this, if possible).

We use the imm dataset[^imm_dataset] for this. We first need to build the mean shape of the all the images. The dataset has a .asf file and an equally named .jpg file. The .asf file contains the locations of the landmars (normalized by the width and height of the image). In src/imm_points.py we find the ImmPoints class that implements all functions needed to read this file.

[^imm_dataset]: http://www.imm.dtu.dk/~aam/datasets/datasets.html “Imm dataset”

reconstruction.reconstruction.barycentric2cartesian(r1, r2, r3, L)[source]

Given the barycentric weights in L, and cartesian r1, r2, r3 coordinates of points that span the triangle, return the cartesian coordinate of the points that is located at the weights of L.

Returns:
ndarray [x,y] cartesian points.
reconstruction.reconstruction.cartesian2barycentric(r1, r2, r3, r)[source]

Given a triangle spanned by three cartesion points r1, r2, r2, and point r, return the barycentric weights l1, l2, l3.

Returns:
ndarray (of dim 3) weights of the barycentric coordinates
reconstruction.reconstruction.reconstruct_texture(src_image, dst_image, texture_model, src_points, dst_points)[source]

Recontruct texture given the src and dst image

Args:
src_points(aam.AAMPoints) dst_points(aam.AAMPoints)