OpenCV on IOS haar cascade xml file path issues from C++

asked 2013-11-30 11:42:19 -0500

Arash Sharif gravatar image

updated 2013-11-30 12:16:42 -0500

berak gravatar image

So I have my code in C++ and I am able to run it fine on linux/OSX/Android. The problem now is ios. I am simply trying to load the haar cascade xml files via full path "/foo/blah/" and having one heck of a time.

C++ can't confirm the file exists nor can opencv load it. I am new to ios and am aware that the could be a compressed dir like the android .apk dir.

I have confirmed that I'm looking in the right place....or at least I hope I have! to check i use getcwd in c++ to get running directory and I confirm that with the file path to the xml file. It looks legit!

What can I do? The nice part about using C++ for the lib is that I can use one code base for desktop/android/ios. I really don't want to have to mix in Objective-C into my lib just for file paths.

Thanks in advance!

The code I'm using is the following:

    std::ifstream fexists(face_haar_path.c_str());
    if(!fexists.good()) {
        std::cout << "Could not find any facehaar.xml" << std::endl;
        return NO_FACE_HAAR_FILE;

    face_haar.load(face_haar_path); //cv::CascadeClassifier face_haar
edit retag flag offensive close merge delete