I have an exception "Unhandled exception at 0x0F633BD9 (opencv_core2410d.dll) in EyeHelper.exe: 0xC0000005: Access violation writing location 0x00000014." when i try to add siple piece of code "CascadeClassifier faceCascade;" here:
Rect getFaceCoords(Mat& frame, int algorithm)
{
Rect faceBox;
// add here:
// CascadeClassifier faceCascade;
switch (algorithm)
{
//HAAR CASCADE
case 1:
faceBox = Rect(20, 20, 20, 20);
break;
case 2:
break;
default:
break;
}
return faceBox;
}
Without CascadeClassifier everything works fine. Exception occurs AFTER RETURN the method! i made simple bool or void function and create CascadeClassifier faceCascade there, it works, faceCascade.detectMultiScale also can find faces, but when the method is over, and it goes to return - exception. i have no idea what to do, i tried "faceCascade.~CascadeClassifier();" befor return, but it doesn't work as expected.
What could be the reason of exception, how to fix it (or how can i use Haar Cascade in other way)?
I'm working in VS2013, use MFC project. in project properties i have: platform toolset "Visual Studio 2013 (v120)" AdditionalLibraryDirectories $(OPENCV_BUILD)\x86\vc12\lib\; use opencv2. all AdditionalDependencies (libs) are like "opencv_core2410d.lib" (all with "d").
i'm working according to this example: http://docs.opencv.org/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html