计算机视觉之统计形状模型——Stasm源码阅读
来源:互联网 发布:北京市人口分布数据 编辑:程序博客网 时间:2024/06/06 17:39
我下载的是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
const Shape& inshape, // in: the current position of the landmarks
const Shape& meanshape, // in: n x 2
const VEC& eigvals, // in: neigs x 1
const MAT& eigvecs, // in: 2n x neigs
const MAT& eigvecsi, // in: neigs x 2n, inverse of eigvecs
const double bmax, // in: for LimitB
const VEC& pointweights) // in: contribution of each point to the pose
这个函数拟合模型到新的形状,是形状模型中非常重要的一步。
3、asm.cpp:
typedef vector<const Mod*> vec_Mod;
类Mod:用来找到landmark点的ASM模型
成员变量:
成员函数:
构造函数:
Shape ModSearch_( // returns coords of the facial landmarks
const Shape& startshape, // in: startshape roughly positioned on face
const Image& img, // in: grayscale image (typically just ROI)
const Shape* pinnedshape=NULL) // in: pinned landmarks, NULL if nothing pinned
4、stasm_lib.cpp
变量:
static vec_Mod mods_g; // the ASM model(s)
static FaceDet facedet_g; // the face detector
static Image img_g; // the current image
函数:
int stasm_search_single( // wrapper for stasm_search_auto and friends
int* foundface, // out: 0=no face, 1=found face
float* landmarks, // out: x0, y0, x1, y1, ..., caller must allocate
const char* img, // in: gray image data, top left corner at 0,0
int width, // in: image width
int height, // in: image height
const char* imgpath, // in: image path, used only for err msgs and debug
const char* datadir) // in: directory of face detector files
根据输入的图片数据及信息,得到其中的landmark点int stasm_open_image_ext( // extended version of stasm_open_image
const char* img, // in: gray image data, top left corner at 0,0
int width, // in: image width
int height, // in: image height
const char* imgpath, // in: image path, used only for err msgs and debug
int multiface, // in: 0=return only one face, 1=allow multiple faces
int minwidth, // in: min face width as percentage of img width
void* user) // in: NULL or pointer to user abort func
apps文件夹
包含了各种测试程序。
- 计算机视觉之统计形状模型——Stasm源码阅读
- 计算机视觉之统计形状模型——Active Shape Model
- 计算机视觉之图像分割——Snake模型(1译文)
- “计算机视觉”阅读笔记
- stasm 对齐关键源码
- 相机模型-计算机视觉
- 计算机视觉-相机模型
- 计算机视觉算法源码
- 计算机视觉算法源码
- 《计算机视觉—算法与应用》第十四章“识别”阅读笔记
- 【机器视觉】 概率模型与计算机视觉
- 计算机视觉——SIFT算法之高斯金字塔
- 计算机视觉之图像特征——曲率curvature
- 计算机视觉之跟踪算法——CamShift跟踪算法
- 计算机视觉之图像分割——分水岭算法WaterShed
- 计算机视觉之图像特征——图像梯度
- 计算机视觉——SIFT算法之高斯金字塔
- (01)opencv之计算机视觉——安装opencv
- js 移动端 tab切换栏下使用多个Swiper
- OPENGL—环境配置
- Algorithm-Gossip(1) 河内之塔 / 汉罗塔
- 动态规划之求最短路径(java版)
- Solr简介(1)
- 计算机视觉之统计形状模型——Stasm源码阅读
- 树莓派+超声波模块
- 17year plan
- 漫步数理统计十五——两个随机变量的分布
- hihocoder 1504 : 骑士游历 矩阵快速幂
- POJ 1265 Area(Pick定理、向量积求面积)
- CSU
- 表达式求值
- 数据结构-关联容器(C++)