Currently I am trying to using an OpenCV Cascade Classifier to detect faces in my iOS app. The problem is that when I go to load the classifier, it fails because the pathname to the "haarcascade_frontalface_alt.xml" isn't correct.
Here is my code:
cv::String face_cascade_name = "haarcascade_frontalface_alt.xml";
void detectFaces(cv::Mat frame){
cv::CascadeClassifier face_cascade;
if (face_cascade.load(face_cascade_name)){
printf("Load complete");
}else{
printf("Load error");
}
std::vector<cv::Rect> faces;
std::vector<cv::Mat> rgbChannels(3);
cv::split(frame, rgbChannels); // Making the frame gray scale
cv::Mat frame_gray = rgbChannels[2];
face_cascade.detectMultiScale(frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE|CV_HAAR_FIND_BIGGEST_OBJECT, cv::Size(150,150));
if(faces.size()> 0){
printf("TRUE");
}
}
Since this is an iOS project I don't know how to find the path of the required xml file in the framework. What is the proper way to load a Cascade Classifier into an iOS project? Or, what is the correct way to include the right filename so that it sees it properly?
Any help would be appreciated.