Ask Your Question
0

0xC000001D: Illegal Instruction when running cvHaarDetectObjects

asked 2012-11-28 23:31:46 -0500

jeng gravatar image

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

edit retag flag offensive close merge delete

Comments

Hi! Can you debug this and say, which line causes the error?

Daniil Osokin gravatar imageDaniil Osokin ( 2012-11-29 01:45:39 -0500 )edit

this line: CvSeq* objects = cvHaarDetectObjects( img, cascade, storage, 1.1, 2, 0, cvSize(40, 40) );

i step into function, after the program enter cvSize() function twice, then error pop up show " 0xC000001D: Illegal Instruction"

jeng gravatar imagejeng ( 2012-11-30 02:57:42 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2012-12-03 07:48:27 -0500

Hi!I have the same question like yours, but I find that "haarcascade_frontalface_alt2.xml" works well, so maybe you can chang "haarcascade_frontalface_alt.xml" to "haarcascade_frontalface_alt2.xml". Wish it will help you!

edit flag offensive delete link more

Comments

Thank You, It works for me too.

Nikola gravatar imageNikola ( 2013-01-15 18:35:50 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2012-11-28 23:31:46 -0500

Seen: 1,073 times

Last updated: Dec 03 '12