Random header image... Refresh for more!

When In Doubt, Link Debug.

So, there’s apparently a bug somewhere in OpenCV that happens when you try to load a Haar Classifier file.  The error you get is the following:

—————————
OpenCV GUI Error Handler
—————————
Unspecified error (The node does not represent a user object (unknown type?))
in function cvRead, .\cxpersistence.cpp(5061)

Press “Abort” to terminate application.
Press “Retry” to debug (if the app is running under debugger).
Press “Ignore” to continue (this is not safe).

—————————
Abort   Retry   Ignore  
—————————

I’ve found references to this crash which indicate that the error has been happening for several years and several iterations and was not fixed in the version I’m using from early September.  (It may be gone in 2.0, not sure.)  The “fix” that most people recommend is to link against cvd.lib, rather than cv.lib. 

Now…  I haven’t fully researched this since I’m not dealing with the C libraries directly, but from the looks of it, they’re suggesting that you link against the debug build of the library and your problems will go away.

What a wonderful fix for a bug in a high-performance math-heavy visual processing library!

There is, however, a less commonly described workaround that won’t be totally dumb.  You do some other operation before calling load, such as creating a junk image and doing something to it. This is what I used and it worked for me:

//Workaround for crashing bug while loading classifier.
IplImage fakeImage = new IplImage(100, 100, BitDepth.U8, 1);
fakeImage.Erode(fakeImage);
fakeImage.Dispose();

0 comments

There are no comments yet...

Kick things off by filling out the form below.

Leave a Comment