cascade_classifier.load("haartraining_frontface_alt.xml") gives error

asked 2015-03-13 00:23:59 -0500

tomnjerry gravatar image

updated 2015-03-13 02:20:43 -0500

I am working on 64 bit Ubuntu 14.04 system.
After successfully integrating Eclipse CDT with OpenCV 2.4.9 and running a basic program pretty well, I wrote following code.

int main()
{
    CascadeClassifier face_cascade;
    if (!face_cascade.load("haarcascade_frontalface_alt.xml"));
    {
        cout<< "Error loading the image";
    }


    Mat Image = imread("1.jpeg");
    Mat grayImage;
    vector<Rect> faces;

    cvtColor(Image, grayImage, CV_BGR2GRAY);
    face_cascade.detectMultiScale(grayImage, faces, 1.1, 3, CV_HAAR_SCALE_IMAGE | CV_HAAR_DO_CANNY_PRUNING, cvSize(300,300));
    for(int i=0; i < faces.size();i++)
    {
        Point pt1(faces[i].x+faces[i].width, faces[i].y+faces[i].height);
        Point pt2(faces[i].x,faces[i].y);
        rectangle(Image, pt1, pt2, cvScalar(0,255,0), 2, 8, 0);
    }

    imshow("Result", Image);
    waitKey(3);
    char c = waitKey(3);
    return 0;
}

I keep getting the error saying: 1). invalid arguments: candidates are bool load(const ? &).. semantic error 2). function rectangle could not be solved 3). invalid arguments: candidates can be void detectMultiScale(const cv::Mat &, ? &, double, int, int, cv::Size_<int>, cv::Size_<int>) void detectMultiScale(const cv::Mat &, ? &, ? &, ? &, double, int, int, cv::Size_<int>, cv::Size_<int>, bool)

I am unable to solve the problem. Any help or suggestion would be really helpful.

edit retag flag offensive close merge delete