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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With