| 251 | } |
| 252 | |
| 253 | static Shape AlignMeanShapeToRightEyeMouth( |
| 254 | const DetectorParameter& detpar, // in |
| 255 | const Shape& meanshape) // in |
| 256 | { |
| 257 | if (trace_g) |
| 258 | lprintf("AlignToRightEyeMouth "); |
| 259 | |
| 260 | CV_Assert(NSIZE(meanshape) > 0 && PointUsed(meanshape, 0)); |
| 261 | CV_Assert(!Valid(detpar.lex)); // left eye invalid? (else why are we here?) |
| 262 | CV_Assert(Valid(detpar.rex)); // right eye valid? |
| 263 | CV_Assert(Valid(detpar.mouthx)); // mouth valid? |
| 264 | |
| 265 | const Shape shape17(Shape17(meanshape)); |
| 266 | |
| 267 | const double x_meanmouth = |
| 268 | (shape17(L17_CTopOfTopLip, IX) + shape17(L17_CBotOfBotLip, IX)) / 2; |
| 269 | |
| 270 | const double y_meanmouth = |
| 271 | (shape17(L17_CTopOfTopLip, IY) + shape17(L17_CBotOfBotLip, IY)) / 2; |
| 272 | |
| 273 | Shape meanline(2, 2), detline(2, 2); // line from eye to mouth |
| 274 | |
| 275 | meanline(0, IX) = shape17(L17_RPupil, IX); // right eye |
| 276 | meanline(0, IY) = shape17(L17_RPupil, IY); |
| 277 | meanline(1, IX) = x_meanmouth; // mouth |
| 278 | meanline(1, IY) = y_meanmouth; |
| 279 | |
| 280 | detline(0, IX) = detpar.rex; // right eye |
| 281 | detline(0, IY) = detpar.rey; |
| 282 | detline(1, IX) = detpar.mouthx; // mouth |
| 283 | detline(1, IY) = detpar.mouthy; |
| 284 | |
| 285 | return TransformShape(meanshape, AlignmentMat(meanline, detline)); |
| 286 | } |
| 287 | |
| 288 | static void FlipIfLeftFacing( |
| 289 | Shape& shape, // io |
no test coverage detected