Ask Your Question

Arash Sharif's profile - activity

2015-01-25 08:34:35 -0600 received badge  Student (source)
2013-11-30 11:50:08 -0600 received badge  Editor (source)
2013-11-30 11:42:19 -0600 asked a question OpenCV on IOS haar cascade xml file path issues from C++

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/myapp.app/haar.xml" 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 myapp.app 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