| 408 | } |
| 409 | |
| 410 | static void TraceEyesMouth( |
| 411 | Image& face_roi, // out: ROI around face, possibly rotated upright |
| 412 | DetectorParameter& detpar_roi) // out: detpar wrt to face_roi |
| 413 | { |
| 414 | #if TRACE_IMAGES // will be 0 unless debugging (defined in stasm.h) |
| 415 | |
| 416 | CImage cimg; |
| 417 | cvtColor(face_roi, cimg, CV_GRAY2BGR); // color image |
| 418 | cv::rectangle(cimg, |
| 419 | cv::Point(cvRound(detpar_roi.x - .5 * detpar_roi.width), |
| 420 | cvRound(detpar_roi.y - .5 * detpar_roi.height)), |
| 421 | cv::Point(cvRound(detpar_roi.x + .5 * detpar_roi.width), |
| 422 | cvRound(detpar_roi.y + .5 * detpar_roi.height)), |
| 423 | ToCvColor(C_BLUE), 3); |
| 424 | if (Valid(detpar_roi.lex)) |
| 425 | cv::circle(cimg, |
| 426 | cv::Point(cvRound(detpar_roi.lex), cvRound(detpar_roi.ley)), |
| 427 | MAX(2, face_roi.cols / 40), |
| 428 | cv::Scalar(0, 0, 255), 2); |
| 429 | if (Valid(detpar_roi.rex)) |
| 430 | cv::circle(cimg, |
| 431 | cv::Point(cvRound(detpar_roi.rex), cvRound(detpar_roi.rey)), |
| 432 | MAX(2, face_roi.cols / 40), |
| 433 | cv::Scalar(0, 0, 255), 2); |
| 434 | if (Valid(detpar_roi.mouthx)) |
| 435 | cv::circle(cimg, |
| 436 | cv::Point(cvRound(detpar_roi.mouthx), cvRound(detpar_roi.mouthy)), |
| 437 | MAX(2, face_roi.cols / 40), |
| 438 | cv::Scalar(0, 0, 255), 2); |
| 439 | char s[SLEN]; sprintf(s, "%s_25_eyemouth.bmp", Base(imgpath_g)); |
| 440 | lprintf("%s\n", s); |
| 441 | if (!cv::imwrite(s, cimg)) |
| 442 | Err("Cannot write %s", s); |
| 443 | |
| 444 | #endif |
| 445 | } |
| 446 | |
| 447 | double EyeAngle( // eye angle in degrees, INVALID if eye angle not available |
| 448 | const DetectorParameter& detpar) // in: detpar wrt the ROI |