3

OpenCV includes face detection sample code. I tried to use facedetect.cpp from OpenCV 2.2 library in my application. However, I happened to a runtime problem

OpenCV error: Null pointer(Null filename) in unknown function, file..\..\..\..\ocv\opencv\modules\core\src\persistence.cpp,line 2571

I googled it and found lots of people ran across this problem, but without a good solution. This problem happened when code load .xml file. My solution is here:

const char *cascadeNameChar=cascadeName.c_str();
const char *nestedCascadeNameChar=nestedCascadeName.c_str();
......
if( !cvLoad( nestedCascadeNameChar ) )
if(!cascade.load(cascadeName))

Then it works for me. I run it on Visual Studio 2008.

1 Answer 1

2

Mates, I have figured out this problem. I used opencv2.2+Visual Studio 2008 when I happened to this problem. The Opencv2.2 is binary version I downloaded from http://sourceforge.net that have been compiled with respect to vc2010. I just now downloaded vc2010 and try my application with facedetect.cpp from opencv2.2 on it. It works! The runtime error with persistence.cpp is gone.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.