OpenCV faceDetecter yaml model loading error

422 Views Asked by At

I have an error loading a .yaml model to FacemarkLBF from openCV.

cv_landmarks = cv::face::FacemarkLBF::create();
std::cout << "Loading OpenCV model for landmark detection." << std::endl;
cv_landmarks->loadModel("lbfmodel.yaml");
faceDetector.load("haarcascade_frontalface_alt2.xml");

Im getting this error:

loading data from : lbfmodel.yaml
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: OpenCV(4.3.0) /tmp/opencv-20200408-5080-l00ytm/opencv-4.3.0/opencv_contrib/modules/face/src/facemarkLBF.cpp:487: error: (-5:Bad argument) No valid input file was given, please check the given filename. in function 'loadModel'

This model works fine on visual studio, but I need to make the project using Xcode to use it later for iOS.

PS: I tried different models, and I got always the same error.

1

There are 1 best solutions below

0
SWAPNIL On

Provide absolute path for reading the model and it will work then.