Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple OpenCV command works in Debug mode but not Release mode

I am trying to load in a training xml file with CascadeClassifier::load(), and it works just fine in Debug mode, but in Release mode I get a runtime error.

The error I get is:

Unhandled exception at 0x000007feefbf4938 in Testing.exe: 0xC0000005: Access violation writing location 0x0000000000000027.

My code is as follows:

CascadeClassifier c;
if (!c.load("C:/data/haarcascade_frontalface_alt.xml"))
{
    exit(1);
}

The code crashes on the loading line. Why would this happen?

like image 307
zebra Avatar asked Jan 14 '12 02:01

zebra


1 Answers

make sure you're linking to openCV's release dlls when running in release mode. I've had similar problems when I tried to load files with mixed release and debug dlls.

See this post.

like image 193
Ben Avatar answered Nov 12 '22 13:11

Ben