开发者

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

开发者 https://www.devze.com 2023-03-10 07:02 出处:网络
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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消