Statistical analysis of 2D shapes based on "Generalized Procrustes Analysis" (Gower, J.C.) and "Active Shape Models - Their Training and Application" (Cootes et al.)
The dataset of 2D face images is publicly available here: IMM Face Database.
Download the data from the above link, place the files data_clean.sh
and to_mat.py
in the root directory of the downloaded data and run:
bash data_clean.sh
python3 to_mat.py
This will create faces2D.mat
in the data
directory.
- See
code/main_1.mlx
for approach based on Generalized Procrustes Analysis andcode/main_2.mlx
for approach based on Active Shape Models.
code/main_1.mlx
: Main script for the approach based on Generalized Procrustes Analysiscode/main_2.mlx
: Main script for approach based on Active Shape Modelscode/align1.m
: Align two given pointsets of equal cardinality via similarity transformations assuming that the pointset representations are standardized to pre-shape spacecode/align2.m
: Align two given pointsets of equal cardinality via similarity transformations, solving for the scale, translation, and rotation jointlycode/optimize1.m
: Runs the algorithm in the pre-shape space and usesalign1.m
code/optimize2.m
: Runs the algorithm in the original space and uses align2.mcode/toPreshape.m
: Standardizes the pointset to pre-shape spacecode/updateMean.m
: Finds the optimal shape mean given the aligned pointsetscode/plotPointsets.m
: Plots the set of pointsets as a scatter plot, each pointset in a different colorcode/plotWithMode.m
: Plots the pointsets along with two sets of variation about the mean along the given mode of variation