error in cascade classifier for image input

asked 2016-02-16 22:12:25 -0500

GANESH PRASAATH L gravatar image

updated 2016-02-17 02:22:51 -0500

i have implemented using MS visual studio 2010 and opencv 2.4.9


    #include "opencv2/objdetect/objdetect.hpp"
 #include "opencv2/highgui/highgui.hpp"
 #include "opencv2/imgproc/imgproc.hpp"

 #include "iostream"
 #include "stdio.h"

using namespace std;
using namespace cv;

int main()
{
    Mat frame=imread("F:\\new.jpg");
    namedWindow("HAAR");
    CascadeClassifier face_cascade; 
    vector<Rect> faces;
    Mat frame_gray;

    cvtColor( frame, frame_gray, CV_BGR2GRAY );
    equalizeHist( frame_gray, frame_gray );
    if( !face_cascade.load( "haarcascade_frontalface_alt.xml") )
    { 
      printf("--(!)Error loading\n");
      return -1;
    };
    face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) );
    for( size_t i = 0; i < faces.size(); i++ )
    {
         Point center( faces[i].x + faces[i].width*0.5, faces[i].y + faces[i].height*0.5 );
         ellipse( frame, center, Size( faces[i].width*0.5, faces[i].height*0.5), 0, 0, 360, Scalar( 255, 0, 255 ), 4, 8, 0 );
    }
    imshow("HAAR", frame );
}


----------
edit retag flag offensive close merge delete

Comments

6

and the error / problem is ?

berak gravatar imageberak ( 2016-02-17 00:49:56 -0500 )edit