| 202 | // allows detpar to be handled uniformly in PinnedStartShapeAndRoi. |
| 203 | |
| 204 | static DetectorParameter PseudoDetParFromStartShape( |
| 205 | const Shape& startshape, |
| 206 | double rot, |
| 207 | double yaw, |
| 208 | int nmods) |
| 209 | { |
| 210 | const Shape shape17(Shape17(startshape)); |
| 211 | const double lex = shape17(L17_LPupil, IX); // left eye |
| 212 | const double ley = shape17(L17_LPupil, IY); |
| 213 | const double rex = shape17(L17_RPupil, IX); // right eye |
| 214 | const double rey = shape17(L17_RPupil, IY); |
| 215 | const double mouthx = shape17(L17_CBotOfBotLip, IX); // mouth |
| 216 | const double mouthy = shape17(L17_CBotOfBotLip, IY); |
| 217 | |
| 218 | CV_Assert(PointUsed(lex, ley)); |
| 219 | CV_Assert(PointUsed(rex, rey)); |
| 220 | CV_Assert(PointUsed(mouthx, mouthy)); |
| 221 | |
| 222 | const double xeye = (lex + rex) / 2; // midpoint of eyes |
| 223 | const double yeye = (ley + rey) / 2; |
| 224 | const double eyemouth = PointDist(xeye, yeye, mouthx, mouthy); |
| 225 | |
| 226 | DetectorParameter detpar; |
| 227 | |
| 228 | detpar.x = .7 * xeye + .3 * mouthx; |
| 229 | detpar.y = .7 * yeye + .3 * mouthy; |
| 230 | detpar.width = 2.0 * eyemouth; |
| 231 | detpar.height = 2.0 * eyemouth; |
| 232 | detpar.lex = lex; |
| 233 | detpar.ley = ley; |
| 234 | detpar.rex = rex; |
| 235 | detpar.rey = rey; |
| 236 | detpar.mouthx = mouthx; |
| 237 | detpar.mouthy = mouthy; |
| 238 | detpar.rot = rot; |
| 239 | detpar.eyaw = DegreesAsEyaw(yaw, nmods); // determines what ASM model to use |
| 240 | detpar.yaw = yaw; |
| 241 | |
| 242 | return detpar; |
| 243 | } |
| 244 | |
| 245 | // Use the given pinned face landmarks to init the start shape. The |
| 246 | // current implementation works best if the pinned landmarks are the five |
no test coverage detected