MCPcopy Create free account
hub / github.com/KAlO2/PerfectShow / EstartEyeMouth

Function EstartEyeMouth

jni/stasm/startshape.cpp:332–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330}
331
332static Shape EstartEyeMouth(
333 const DetectorParameter& detpar_roi, // in: detpar wrt the ROI
334 const Image& face_roi, // in
335 const Shape& meanshape) // in
336{
337 Shape startshape;
338 Shape meanshape1(meanshape);
339 if (Valid(detpar_roi.mouthx) && // both eyes and mouth?
340 Valid(detpar_roi.lex) &&
341 Valid(detpar_roi.rex))
342 {
343 FlipIfLeftFacing(meanshape1, detpar_roi.eyaw, face_roi.cols);
344 startshape = AlignMeanShapeToBothEyesMouth(detpar_roi, meanshape1);
345 FlipIfLeftFacing(startshape, detpar_roi.eyaw, face_roi.cols);
346 }
347 else if (Valid(detpar_roi.lex) && // both eyes?
348 Valid(detpar_roi.rex))
349 {
350 FlipIfLeftFacing(meanshape1, detpar_roi.eyaw, face_roi.cols);
351 // TODO Tune the following code, what approach is best?
352 if (detpar_roi.eyaw == EYAW00)
353 startshape = AlignMeanShapeToBothEyesEstMouth(detpar_roi, meanshape1);
354 else
355 startshape = AlignMeanShapeToBothEyesNoMouth(detpar_roi, meanshape1);
356 FlipIfLeftFacing(startshape, detpar_roi.eyaw, face_roi.cols);
357 }
358 else if (Valid(detpar_roi.mouthx) && // left eye and mouth?
359 Valid(detpar_roi.lex))
360 {
361 FlipIfLeftFacing(meanshape1, detpar_roi.eyaw, face_roi.cols);
362 startshape = AlignMeanShapeToLeftEyeMouth(detpar_roi, meanshape1);
363 FlipIfLeftFacing(startshape, detpar_roi.eyaw, face_roi.cols);
364 }
365 else if (Valid(detpar_roi.mouthx) && // right eye and mouth?
366 Valid(detpar_roi.rex))
367 {
368 FlipIfLeftFacing(meanshape1, detpar_roi.eyaw, face_roi.cols);
369 startshape = AlignMeanShapeToRightEyeMouth(detpar_roi, meanshape1);
370 FlipIfLeftFacing(startshape, detpar_roi.eyaw, face_roi.cols);
371 }
372 else // last resort: use the face det rectangle (can't use facial features)
373 {
374 startshape =
375 AlignMeanShapeToFaceDet(detpar_roi, meanshape1,
376 FACERECT_SCALE_WHEN_NO_EYES, face_roi);
377 }
378 return startshape;
379}
380
381// Align the model meanshape to the detpar from the face and feature dets.
382// Complexity enters in because the detected eyes and mouth may be useful

Callers 1

StartShapeFromDetParFunction · 0.85

Calls 8

ValidFunction · 0.85
FlipIfLeftFacingFunction · 0.85
AlignMeanShapeToFaceDetFunction · 0.85

Tested by

no test coverage detected