使用HAAR分类器检测面部

时间:2017-06-12 11:38:35

标签: c++ opencv image-processing haar-classifier

for (int i = 0; i < 2; i++)
{

    std::vector<Rect> faces;
    Mat Ycbcr;
    face_cascade.detectMultiScale(images[i], faces, 1.1, 2, 0 | CV_HAAR_SCALE_IMAGE, Size(30, 30));

    for (int l = 0; l < faces.size(); l++)
    {
        Point center(faces[l].x + faces[l].width*0.5, faces[l].y + faces[l].height*0.5);

        Mat temp = x.clone();
        Ycbcr = temp(faces[l]); //do something}}

此代码在第二次迭代中从行face_cascade.detectMultiScale(images[i], faces, 1.1, 2, 0 | CV_HAAR_SCALE_IMAGE, Size(30, 30));给出错误。可能是什么原因

0 个答案:

没有答案