Ask Your Question

Revision history [back]

scan only the lower half of a ROI?/ ROI within an ROI?

I am creating a facial tracking program that uses cascades that I have trained myself. In the code below the face is set as a ROI so the cascades that i have created only work in this area when a face is initially found. How would I go about scanning just the bottom half of the "faceROI"? (so that I can scan where a mouth would be).

face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CASCADE_SCALE_IMAGE, Size(30, 30) );


for ( size_t i = 0; i < faces.size(); i++ )
{
    Point center( faces[i].x + faces[i].width/2, faces[i].y + faces[i].height/2 );
    ellipse( frame, center, Size( faces[i].width/2, faces[i].height/2 ), 0, 0, 360, Scalar( 255, 0, 255 ), 4, 8, 0 );

    Mat faceROI = frame_gray( faces[i] );



    eyes_cascade.detectMultiScale( faceROI, eyes, 1.1, 2, 0 |CASCADE_SCALE_IMAGE, Size(30, 30) );
    nose_cascade.detectMultiScale( faceROI, nose, 1.1, 2, 0 |CASCADE_SCALE_IMAGE, Size(30, 30) );
    mouth_cascade.detectMultiScale( faceROI, mouth, 1.1, 2, 0 |CASCADE_SCALE_IMAGE, Size(30, 30) );`