我下载的是Stasm 4.1.0版本。
stasm文件夹
包含的是模型的实现。主要的源码文件是 stasm_lib.cpp,其中的函数stasm_search_single()是主要接口函数,在给定的一张人脸图片中搜索landmark点。
1、MOD_1文件夹对ASM进行初始化,给出特征向量、特征值以及对b的约束值,是一个已经训练好的模型。
MOD_1/initasm.cpp:
函数:
void InitMods( // initialize 一个 ASM model
vec_Mod& mods, // out: ASM model (only one model in this version of Stasm)
const char* datadir) // in: directory of face detector files
2、Shapemod.cpp:
变量:
static const int SHAPEHACK_MINPYRLEV = 2;
函数:
static void LimitB(
VEC& b, // io: eigvec weights
const VEC& eigvals, // in
double bmax) // in
对b约束到bmax * sqrt(lambda_i)Shape ConformShapeToMod( // Return a copy of inshape conformed to the model
VEC& b, // io: eigvec weights, 2n x 1