Zahra Hussain
Zahra Hussain

Reputation: 13

Cascade file error loading

I'm using the opencv tutorial for face detection I have done exactly how they explained, and the code works fine but the part where the xml file should be loaded is giving me the error msg!

if( !face_cascade.load( face_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; };

if( !eyes_cascade.load( eyes_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; };

I have the cascade xml files in my directory.

When I make these two lines as comments, the code works fine and the cam turns on but of course it doesn't detect my face!

Upvotes: 1

Views: 3881

Answers (2)

Cherler Ton
Cherler Ton

Reputation: 1

when you have no error on path or absolute path, you should see whether your linking lib is error; probably you linking release lib in Debug configuration, or you put all release libraries and debug libraries in your project.

Upvotes: 0

berak
berak

Reputation: 39806

There's some hidden assumption here, that the program starts from the the same directory, where the cascade files are. That might not be so in your case.

I bet it runs correctly, if you specify an absolute path

String face_cascade_name = "c:/la/la/la/haarcascade_frontalface_alt.xml";

Same again for the eyes_cascade.

Upvotes: 1

Related Questions