| 25 | //----------------------------------------------------------------------------- |
| 26 | |
| 27 | class Mod // An ASM model for finding landmarks. |
| 28 | { // If multiple model Stasm, will use a separate Mod for each yaw range. |
| 29 | public: |
| 30 | Shape ModSearch_( // returns coords of the facial landmarks |
| 31 | const Shape& startshape, // in: startshape roughly positioned on face |
| 32 | const Image& img, // in: grayscale image (typically just ROI) |
| 33 | const Shape* pinnedshape=NULL) // in: pinned landmarks, NULL if nothing pinned |
| 34 | const; |
| 35 | |
| 36 | const Shape ConformShapeToMod_Pinned_( // wrapper around the func in ShapeMod |
| 37 | const Shape& shape, // in |
| 38 | const Shape& pinnedshape) // in |
| 39 | const |
| 40 | { |
| 41 | VEC b(NSIZE(shapemod_.eigvals_), 1, 0.); // dummy variable for call below |
| 42 | return shapemod_.ConformShapeToMod_Pinned_(b, shape, 0, pinnedshape); |
| 43 | } |
| 44 | |
| 45 | // readonly access to some private vars |
| 46 | ESTART Estart_(void) const { return estart_; } |
| 47 | const char* DataDir_(void) const { return datadir_.c_str(); } |
| 48 | const Shape MeanShape_(void) const { return shapemod_.meanshape_; } |
| 49 | |
| 50 | private: |
| 51 | const vec_vec_BaseDescMod DescMods_( // utility for Mod constructor |
| 52 | const BaseDescMod** const descmods_arg, // in: descriptor models |
| 53 | int ndescmods) // in: sanity check |
| 54 | { |
| 55 | if (stasm_NLANDMARKS != ndescmods / N_PYR_LEVS) // sanity check |
| 56 | { |
| 57 | Err("stasm_NLANDMARKS != ndescmods / N_PYR_LEVS\n\n" |
| 58 | " stasm_NLANDMARKS %d\n ndescmods / N_PYR_LEVS %d\n" |
| 59 | " ndescmods %d\n N_PYR_LEVS %d", |
| 60 | stasm_NLANDMARKS, ndescmods / N_PYR_LEVS, |
| 61 | ndescmods, N_PYR_LEVS); |
| 62 | } |
| 63 | vec_vec_BaseDescMod descmods(N_PYR_LEVS); |
| 64 | |
| 65 | for (int ilev = 0; ilev < N_PYR_LEVS; ilev++) |
| 66 | { |
| 67 | descmods[ilev].resize(stasm_NLANDMARKS); |
| 68 | for (int i = 0; i < stasm_NLANDMARKS; i++) |
| 69 | descmods[ilev][i] = |
| 70 | descmods_arg[ilev * stasm_NLANDMARKS + i]; |
| 71 | } |
| 72 | return descmods; |
| 73 | } |
| 74 | |
| 75 | public: |
| 76 | Mod(EYAW eyaw, // constructor |
| 77 | ESTART estart, |
| 78 | std::string datadir, |
| 79 | Shape meanshape, |
| 80 | VEC eigvals, |
| 81 | MAT eigvecs, |
| 82 | int neigs, |
| 83 | double bmax, |
| 84 | unsigned hackbits, |
nothing calls this directly
no outgoing calls
no test coverage detected