Ask Your Question

Revision history [back]

0xC000001D: Illegal Instruction when running cvHaarDetectObjects

I get 0xC000001D: Illegal Instruction when running cvHaarDetectObject. Below is my code

int main() {

IplImage* img;
img = cvLoadImage( "lena.jpg",1);

CvMemStorage* storage = cvCreateMemStorage(0);
CvHaarClassifierCascade* cascade = (CvHaarClassifierCascade*)cvLoad( "haarcascade_frontalface_alt2.xml" );


static CvScalar colors[] = { {{0,0,255}}, {{0,128,255}}, {{0,255,255}}, 
{{0,255,0}}, {{255,128,0}}, {{255,255,0}}, {{255,0,0}}, {{255,0,255}} };

// Detect objects
cvClearMemStorage( storage );
CvSeq* objects = cvHaarDetectObjects( img, cascade, storage, 1.1, 2, 0, cvSize(40, 40) );

CvRect* r;
// Loop through objects and draw boxes
for( int i = 0; i < (objects ? objects->total : 0 ); i++ ){
    r = ( CvRect* )cvGetSeqElem( objects, i );
    cvRectangle( img, cvPoint( r->x, r->y ), cvPoint( r->x + r->width, r->y + r->height ),
        colors[i%8]);
}

cvNamedWindow( "Output" );
cvShowImage( "Output", img );
cvWaitKey();


cvReleaseImage( &img );

return 0;

}

Is it something wrong with setup? I can compile the code, but when i run it, i get this error. ANy idea want cause this error?

Thanks and Best Regards