for (rate = 2; rate <= 7; rate += 1) //for each window
{
len = BaseLen*rate; //检测人脸的窗口边长(默认正方形)[50, 75, 100, 125, 150, 175]
cout << "current window len is: " << len << endl;
step = len/2;
for (x = 0; x < image->width - len; x += step) //for each x
{
for (y = 0; y < image->height - len; y += step) //for each y
{
int faceFlag = 1;
for (j = 0; j < strClfInfoList.size(); j++) //for each str clf
{
strClfInfo = strClfInfoList[j];
result = MyFD(x, y, len, len, sumPixel, strClfInfo, featureList); //(int x, int y, int w, int h)
if (result == 0)//one str clf say this is NOT a face, then REGECT this image
{
//cout << "x=" << x << "; y=" << y << "; len=" << len << " ==> NOT a face" << endl;
faceFlag = 0;
break;
}
}
if (faceFlag == 1) //ALL str clf say this IS a face, then draw
{
//draw window on the img
Point center(x + len*0.5, y + len*0.5);
ellipse(img, center, Size(len*0.5, len*0.5), 0, 0, 360, Scalar(255, 0, 255), 4, 8, 0);
rectangle(img, Point(x, y), Point(x + len, y + len), Scalar(0, 255, 255));
//imshow("FaceDection", img);
//waitKey(0);
}
}
}
}