1 | initial version |
You forgot to set ROI for mouth detection:
/* detect mouth */
cvSetImageROI(img,mouthROI); //<-HERE
CvSeq *mouth = cvHaarDetectObjects(
img,
cascade_m,
storage,
1.1,
3,
0,
cvSize( 10, 10 ) );
cvResetImageROI(img); //<-AND HERE
You should also change the second for loop index, as you have loop inside a loop and you are using the same variable 'i' in both of them. With one face and one mouth it works fine, but with two or more faces it will fail.
2 | No.2 Revision |
You forgot to set ROI for mouth detection:
/* detect mouth */
cvSetImageROI(img,mouthROI); //<-HERE
CvSeq *mouth = cvHaarDetectObjects(
img,
cascade_m,
storage,
1.1,
3,
0,
cvSize( 10, 10 ) );
cvResetImageROI(img); //<-AND HERE
You should also change the second for loop index, as you have loop inside a loop and you are using the same variable 'i' in both of them. With one face and one mouth it works fine, but with two or more faces it will fail.
Besides, stop using the old C interface. Your code in the new C++ interface would be much shorter and easier to read.
3 | No.3 Revision |
You forgot to set ROI for mouth detection:
/* detect mouth */
cvSetImageROI(img,mouthROI); //<-HERE
CvSeq *mouth = cvHaarDetectObjects(
img,
cascade_m,
storage,
1.1,
3,
0,
cvSize( 10, 10 ) );
cvResetImageROI(img); //<-AND HERE
You should also change the second for loop index, as you have a loop inside a loop and you are using the same variable 'i' in both of them. With one face and one mouth it works fine, but with two or more faces it will fail.
Besides, stop using the old C interface. Your code in the new C++ interface would be much shorter and easier to read.