Ask Your Question
0

OpenCV.js Unable to load cascade file

asked 2018-10-15 10:33:25 -0600

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.

edit retag flag offensive close merge delete

Comments

1
berak gravatar imageberak ( 2018-10-15 10:43:39 -0600 )edit

I have, I'm struggling to see what is going wrong.

MichaelJonez gravatar imageMichaelJonez ( 2018-10-15 10:50:28 -0600 )edit

also, the 2nd classifier.load won't work. you have to do that from the calllback.

berak gravatar imageberak ( 2018-10-15 10:53:48 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-04-09 16:11:40 -0600

kavikode gravatar image
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-10-15 10:33:25 -0600

Seen: 1,125 times

Last updated: Apr 09 '19