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

Function MouthInnerRect

jni/stasm/eyedet.cpp:493–540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491// it's better to not find a mouth than to find an incorrect mouth.
492
493static Rect MouthInnerRect(
494 const Rect& facerect, // in
495 EYAW eyaw, // in
496 int ileft_best, // in: index of best left eye, -1 if none
497 int iright_best, // in: index of best right eye, -1 if none
498 const vec_Rect& leyes, // in: left eyes found by eye detector
499 const vec_Rect& reyes) // in: right eyes found by eye detector
500{
501 Rect rect = facerect;
502 double width = (eyaw == EYAW00? .12: .20) * facerect.width;
503 double height = .30 * facerect.height;
504
505 int ixshift, iyshift;
506 MouthRectShift(ixshift, iyshift,
507 eyaw, facerect.width, facerect.height,
508 ileft_best, iright_best, leyes, reyes);
509
510 rect.x += cvRound(.50 * (facerect.width - width)) + ixshift;
511
512 rect.width = cvRound(width);
513
514 switch (eyaw)
515 {
516 case EYAW00: // frontal model
517 rect.y += cvRound(.7 * facerect.height);
518 break;
519 case EYAW_45: // left facing three-quarter model
520 rect.y += cvRound(.65 * facerect.height);
521 break;
522 case EYAW_22: // left facing three-quarter model
523 rect.y += cvRound(.65 * facerect.height);
524 break;
525 case EYAW22: // right facing three-quarter model
526 rect.y += cvRound(.65 * facerect.height);
527 break;
528 case EYAW45: // right facing three-quarter model
529 rect.y += cvRound(.65 * facerect.height);
530 break;
531 default:
532 Err("MouthInnerRect: Invalid eyaw %d", eyaw);
533 break;
534 }
535 rect.y += iyshift;
536 rect.height = cvRound(height);
537 rect.width = MAX(0, rect.width);
538 rect.height = MAX(0, rect.height);
539 return rect;
540}
541
542// The OpenCV mouth detector biases the position of the mouth downward (wrt the
543// center of the mouth determined by manual landmarking). Correct that here.

Callers 2

DrawMouthsFunction · 0.85
DetectEyesAndMouthFunction · 0.85

Calls 2

MouthRectShiftFunction · 0.85
ErrFunction · 0.85

Tested by

no test coverage detected