Reputation: 21
I try bulid face detect applicatyion on Visual Studio 2010 using C++ and OpenCV 2.3.1 library So, I declaration String type and initialize:
String face_cascade_name = "haarcascade_frontalface_alt.xml";
Next, I create a object of class CascadeClassifier:
CascadeClassifier face_cascade;
And I load cascade:
if( !face_cascade.load(face_cascade_name) ){ printf("--(!)Error loading\n"); return -1; };
The project bulid and debugging without problem, but when I run application and application try load cascade program crash!
And I see this communication: The program '[1288] OpenCV2.0.exe: Native' has exited with code -1 (0xffffffff).
Upvotes: 2
Views: 4717
Reputation: 696
In my case(OSX 10.9), I input the whole path instead of simply "haarcascade_frontalface_alt.xml", like "/Users/xxx/Desktop/opencv-2.4.7/data/haarcascades/haarcascade_frontalface_alt.xml". Good Luck
Upvotes: 1
Reputation: 1
In my case (win7 64, VS 10 express), changing file permissions for xml files solved the problem, I added Everyone with full controll, and it worked.
Upvotes: 0
Reputation: 21
I had the same problem with CascadeClassifier
and FileStorage
.
For example if you try this:
FileStorage fs(xml_fname, FileStorage::READ);
if (!fs.isOpened())
{
cout<<"can not read xml"<<endl;
}
Probably, it won't work.
In my case, I passed in VC++ from Debugging mode to Release mode, specified .lib
files without d
at the end (e.g. opencv_core231.lib
) and it works now.
Upvotes: 2