基于Boost方法的人脸检测(5):在一张图片中检测人脸



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);
					}
				}
			}

		}


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值