1 | initial version |
you can recalculate faceROI before mouth detection as shown below.
MatOfRect mouth = new MatOfRect();
// insert this lines
facesArray[i].height = (int) Math.round(facesArray[i].height * 0.5);
facesArray[i].y = facesArray[i].y + facesArray[i].height;
faceROI = mGrey.submat(facesArray[i]);
mouthCascade.detectMultiScale(faceROI, mouth, 1.1, 2, 0, new Size(30, 30), new Size());