Opencv 4.5.0 cascadeClassifier object empty

Using String face_cascade_name = samples::findFile(“data/haarcascades/haarcascade_frontalface_default.xml”);
cv::CascadeClassifier classifier;
assert(classifier.load(face_cascade_name)); After the the call to load method field cc inside classifier is empty (null values everywhere on debug) and i have an error later when i try to apply the classifier for detection. I’ve read a few topics on that issue and checked that the path in face_cascade_name is correct.
PS load returns true because the assert is ok.
Any ideas ?
Best regards.

return value of getcwd()?

check classifier.empty() as well.

getcwd returns C:\Users<>.…\MyFirstOpenCvProject\MyFirstOpenCvProject i am using visual studio on windows. and classifier.empty() returns 1

that means it couldn’t load anything. you should always check that. if you don’t, it’s checked in the detect call and then the program ends with a violated assertion.

that works if the environment is right. can you confirm that the file exists?

if it exists, that function might still require an environment variable pointing it to the opencv install directory, or the data directory specifically. the function is documented. I remember it stating the name of the env var.

Yes the file exists
Ok i’ll search that thanks
Best regards.

I can’t really explain what happened I used simply the absolute path of the file which i already tried, went from realease to debug configuration a few times …
Somehow it finds the file now.