| 8 | namespace stasm |
| 9 | { |
| 10 | class ShapeMod |
| 11 | { |
| 12 | public: |
| 13 | const Shape ConformShapeToMod_( // return shape conformed to shape mod |
| 14 | VEC& b, // io: eigvec weights |
| 15 | const Shape& shape, // in: shape suggested by the descriptor mods |
| 16 | int ilev) // in: pyramid level (0 is full size) |
| 17 | const; |
| 18 | |
| 19 | const Shape ConformShapeToMod_Pinned_( // like above but allow pinned points |
| 20 | VEC& b, // io: eigvec weights |
| 21 | const Shape& shape, // in: shape suggested by the descriptor mods |
| 22 | int ilev, // in: pyramid level (0 is full size) |
| 23 | const Shape& pinnedshape) // in: pinned landmarks |
| 24 | const; |
| 25 | |
| 26 | ShapeMod( // constructor |
| 27 | const Shape& meanshape, |
| 28 | const VEC& eigvals, |
| 29 | const MAT& eigvecs, |
| 30 | const int neigs, |
| 31 | const double bmax, |
| 32 | const unsigned hackbits) |
| 33 | |
| 34 | : meanshape_(meanshape), |
| 35 | eigvals_(DimKeep(eigvals, neigs, 1)), |
| 36 | eigvecs_(DimKeep(eigvecs, eigvecs.rows, neigs)), // retain neigs cols |
| 37 | // take inverse of eigvecs (by taking transpose) and retain neigs rows |
| 38 | eigvecsi_(DimKeep(eigvecs.t(), neigs, eigvecs.cols)), |
| 39 | bmax_(bmax), |
| 40 | hackbits_(hackbits) |
| 41 | { |
| 42 | if (meanshape.rows != stasm_NLANDMARKS) |
| 43 | Err("meanshape.rows %d != stasm_NLANDMARKS %d", |
| 44 | meanshape.rows, stasm_NLANDMARKS); |
| 45 | CV_Assert(meanshape.cols == 2); |
| 46 | CV_Assert(NSIZE(eigvals) == 2 * stasm_NLANDMARKS); |
| 47 | CV_Assert(eigvecs.rows == 2 * stasm_NLANDMARKS); |
| 48 | CV_Assert(eigvecs.cols == 2 * stasm_NLANDMARKS); |
| 49 | CV_Assert(neigs > 0 && neigs <= 2 * stasm_NLANDMARKS); |
| 50 | CV_Assert(bmax > 0 && bmax < 10); |
| 51 | CV_Assert((hackbits & ~(SHAPEHACKS_DEFAULT|SHAPEHACKS_SHIFT_TEMPLE_OUT)) == 0); |
| 52 | } |
| 53 | |
| 54 | // all data remains constant after ShapeMod construction |
| 55 | |
| 56 | const Shape meanshape_; // mean shape aligned to face det frame |
| 57 | const VEC eigvals_; // neigs x 1 vector |
| 58 | const MAT eigvecs_; // 2n x neigs matrix where n is nbr of landmarks |
| 59 | const MAT eigvecsi_; // neigs x 2n matrix, inverse of eigvecs_ |
| 60 | const double bmax_; // eigvec weight limit, for LimitB() |
| 61 | const unsigned hackbits_; // allowable shape model hacks (e.g. SHAPEHACKS_DEFAULT) |
| 62 | |
| 63 | private: |
| 64 | DISALLOW_COPY_AND_ASSIGN(ShapeMod); |
| 65 | |
| 66 | }; // end class ShapeMod |
| 67 |
nothing calls this directly
no outgoing calls
no test coverage detected