OpenCV.js Unable to load cascade file
Hi. I'm having an issue where my project is unable to load the cascade file I want to use. Here is the code that is causing the problem.
let faceCascade = 'haarcascade_frontalface_default.xml';
// Build and load the cascade file
let utils = new Utils('errorMessage');
utils.createFileFromUrl(faceCascade, faceCascade, () => {
console.log('Cascade ready.');
classifier.load(faceCascade)
});
if(!classifier.load(faceCascade)){
console.log('Unable to load cascade file.');
}
It manages get within the createFileFromUrl statement and execute the console.log. However, it is unable to load the xml file when classifier.load is called. There are no errors in the browser but the if statement is executed and confirms that it hasn't been loaded.
I've tried giving the full path to the file, I've tried using alternate cascade files and I've tried loading the files from a separate folder. None of these seem to effect anything. I'm running the web page from a Xampp server and I'm using OpenCV.js version 3.4.3.
I have no idea what the issue could be. Any help would be appreciated, cheers.
please take a look at similar questions
I have, I'm struggling to see what is going wrong.
also, the 2nd
classifier.load
won't work. you have to do that from the calllback.