[英]opencv face-detection in java : conception steps
I'm working on face-detection project via webcam using opencv 我正在使用opencv通过网络摄像头进行人脸检测项目
In this approach (viola-jones) to detecting object in images combines four key concepts : 用这种方法(中提琴-琼斯)检测图像中的对象结合了四个关键概念:
1-Simple rectangular features called haar features ( i can find this one in haarcascade_frontalface_alt.xml file). 1-简单的矩形特征,称为haar特征(我可以在haarcascade_frontalface_alt.xml文件中找到该特征)。
2- An integral Image for raped feature detection. 2-用于强奸特征检测的积分图像。
3- The AdaBoost machine-learning method. 3- AdaBoost机器学习方法。
4-A cascaded classifier to combine many features efficiently. 4-A级联分类器,可有效组合许多功能。
my questions are: 我的问题是:
-does haarcascade_frontalface_alt.xml contains the cascaded classifier also with the haar feature? -haarcascade_frontalface_alt.xml是否也包含具有haar功能的级联分类器?
-how can i add the integral image and AdaBoost in my project and how to use it??or is it already done automatically?? -如何在我的项目中添加积分图像和AdaBoost以及如何使用它?或者它已经自动完成了?
it seems, you've read a lot of papers and pondered ideas, but have not found the opencv implementation ;) 看来,您已经阅读了许多论文和思考过的想法,但是还没有找到opencv实现 ;)
using it is actually quite easy: 使用它实际上很容易:
// setup a cascade classifier:
CascadeClassifier cascade;
// load a pretrained cascadefile(and PLEASE CHECK!):
bool ok = cascade.load("haarcascade_frontalface_alt.xml");
if ( ! ok )
{
...
}
// later, search for stuff in your img:
Mat gray; // uchar grayscale!
vector<Rect> faces; // the result vec
cascade.detectMultiScale( gray, faces, 1.1, 3,
CV_HAAR_FIND_BIGGEST_OBJECT | CV_HAAR_DO_ROUGH_SEARCH ,
cv::Size(20, 20) );
for ( size_t i=0; i<faces.size(); i++ )
{
// gray( faces[i] ); is the img portion that contains the detected object
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.