1 | initial version |
Hi, you can get the ROI of the mouth by adding the following code to the second for loop
cv::Mat croped_image = frame(cv::Rect(pt1, pt2));
for example:
for (int k = 0; k < mouthi.size(); k++)
{
Point pt1(mouthi[0].x + faces[i].x, mouthi[0].y + faces[i].y);
Point pt2(pt1.x + mouthi[0].width, pt1.y + mouthi[0].height);
rectangle(frame, pt1, pt2, Scalar(255, 0, 0), 1, 8, 0);
cv::Mat mouth_image = frame(cv::Rect(pt1, pt2));
// do something with the croped mouth here
// ...
}