📄 asmsearch.hpp
字号:
// $masm\asmsearch.hpp 1.5 milbo$ active shape routines for searching// Warning: this is raw research code -- expect it to be quite messy.// milbo dec05 durban#if !defined(asmsearch_hpp)#define asmsearch_hpptypedef cvec<MatVec> MatVecSub; // a vector of matrices for each sub-profile for each point for each level in the image pyramidtypedef cvec<VecVec> VecVecSub; // a vector of one-dimensional matrices for each sub-profile for each level in the image pyramidtypedef cvec<SparseMat> SparseMatVec; //TODO move this def?typedef cvec<SparseMatVec> SparseMatVecSub; // a vector of one-dimensional matrices for each sub-profile for each level in the image pyramidtypedef struct tAsmLev // ASM data for one level: level 0 is full size, level 1's width is full width/2, etc. { int nEigs, nEigsFinal; // nEigs for nLimitB(), nEigsFinal is what we use for the final search iteration double BMax, BMaxFinal; // for nLimitB() SHAPE MeanShape; // FileMeanShape, scaled for this level MatVecSub Covars; // array[nPoints][nSubProfs] of INVERSE of profile covar matrices, each is mat nPoints x nPoints SparseMatVecSub SparseCovars; // same as Covars, but sparse arrays VecVecSub Profs; // array[nPoints][nSubProfs] of landmark profile row vecs, each is 1 x nPoints cvec<unsigned> ProfSpecs; // see PROF_ defs in prof.hpp Vec EigVals; // n x 1 vector, EigVals scaled for this level }tAsmLev;#define CONF_nMaxModels 2typedef enum eStartMethod // What method do we use to init the search shape? See 07_StartMethod.txt for measurments { SM_UseNnBasic, // This is the simplest neural net alignment method SM_UseNnFaceAndEyes, SM_UseNnFaceAndEyesRealignEyes, // This gives the best results for neural net alignment SM_UsePrevStartShape, // Only use this if a search with a previous Model used SM_UseNn... or SM_UseRefShape to initialize StartShape for the current image // If PrevStartShape has same nbr of rows then use PrevStartShape // different nbr of rows then align FileBaseShape to PrevStartShape SM_UsePrevModelResult, // Use the results of the search with the previous model SM_UseAlignedMeanShape, // Align mean shape to reference shape SM_UseRefShapeAndAlignedMeanShape, SM_UseRefShape, // Copy the reference shape to the start shape, possibly add an offset (CONF_xRefShapeOffset, CONF_yRefShapeOffset) SM_UseViolaJones, // Use Viola Jones detector to align the start shape }eStartMethod;typedef struct tAsmModel { int iModel; char sFile[SLEN]; // file used to initialize model int nPoints; // number of landmarks int nStartLev; // start the search at this level in image pyramid double PyrRatio; int PyrReduceMethod; // one of IM_NEAREST_PIXEL IM_BILINEAR IM_AVERAGE_ALL int nMaxSearchIters; int nShapeModelIters; int nQualifyingDisplacments; int nTrimCovar; // for speeding up search, see comments at top of asmsearch.cpp double SigmoidScale; int nScaledFaceWidth; // if >0 then prescale input face to this size, else don't prescale to fixed size int nPixSearch; bool fExplicitPrevNext; // use iPrev and iNext in LandTab? see atland.hpp bool fFancyShapeModel; // use ConformShapeToModel_Fancy() or ConformShapeToModel_Basic()? see shapeModel.cpp bool fBilinearRescale; // rescale using bilinear of nearest-pixel, only applies if nScaledFaceWidth>0 double NormalizedProfLen; // see comments for masmconf.hpp:CONF_GenNormalizedProfLen eStartMethod StartMethod; SHAPE FileMeanShape; // mean shape read from ASM file Mat EigVecs; // n x n matrix Mat EigInverse; // EigVecs inverted, cached here for convenience and speed tAsmLev AsmLevs[CONF_nMaxLevs]; // active shape model for all pyramid levels }tAsmModel;void InitAsm(tAsmModel &Asm, // out const char sAsmFile[], // in bool fFancyShapeModel, // in int nShapeModelIters, // in eStartMethod StartMethod); // in// model specific fitness for standard active shape modeldouble GetProfileFit(tSearchImages &SearchImgs, // in except SearchImgs.ProgressImg is modified const int iPoint, const int ix, const int iy, const tAsmLev &AsmLev, const SHAPE &Shape, const tLand Lands[], // in const unsigned ProfSpec, const int nTrimCovar);int nGetProfWidthFromModel(int iPoint, int iSub, const tAsmLev &AsmLev);void GenerateCFileFromAsmModel(tAsmModel &m);#endif // asmsearch_hpp
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -