Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

opencv error: Null pointer(Null filename) in unknown function with facedetect. cpp

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.

like image 609
Jackypengyu Avatar asked Apr 03 '26 01:04

Jackypengyu


1 Answers

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.

like image 185
Jackypengyu Avatar answered Apr 08 '26 07:04

Jackypengyu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!