| 51 | // This ignores the eye and mouth, if any. |
| 52 | |
| 53 | static Shape AlignMeanShapeToFaceDet( |
| 54 | const DetectorParameter& detpar, // in |
| 55 | const Shape& meanshape, // in |
| 56 | double scale, // in: scale the face rectangle |
| 57 | const Image& img) // io: the image (grayscale) |
| 58 | { |
| 59 | if (trace_g) |
| 60 | lprintf("AlignToFaceDet "); |
| 61 | |
| 62 | DetectorParameter detpar1(detpar); |
| 63 | |
| 64 | if (IsLeftFacing(detpar.eyaw)) |
| 65 | detpar1 = FlipDetPar(detpar, img.cols); |
| 66 | |
| 67 | CV_Assert(meanshape.rows > 0 && meanshape.cols == 2); |
| 68 | |
| 69 | const double xscale = detpar1.width * scale / DET_FACE_WIDTH; |
| 70 | const double yscale = detpar1.height * scale / DET_FACE_WIDTH; |
| 71 | |
| 72 | Shape startshape = TransformShape(meanshape, |
| 73 | xscale, 0, detpar1.x, |
| 74 | 0, yscale, detpar1.y); |
| 75 | |
| 76 | return startshape; |
| 77 | } |
| 78 | |
| 79 | // Return the model meanshape aligned to both eyes and the mouth. |
| 80 | // |
no test coverage detected