1

I've just updated my iOS project to version OpenCV 3.0 and whenever I try and load the haarcascade file I get an Assertion Fail.

Previous version of OpenCV works fine and there is no change to how I get the path and load the file (see below), it's just seems not to work with version 3.0

NSString *faceCascadePath = [[NSBundle mainBundle] pathForResource:kFaceCascadeFilename ofType:@"xml"];
_faceCascade.load([faceCascadePath UTF8String])

I've also attempted to amend the way I read the file (another example I found below).

const CFIndex CASCADE_NAME_LEN = 2048;
char *CASCADE_NAME = (char *) malloc(CASCADE_NAME_LEN);
CFStringGetFileSystemRepresentation( (CFStringRef)faceCascadePath, CASCADE_NAME, CASCADE_NAME_LEN);

But again to no avail...

Any suggestions would be much appreciated.

C.

1 Answer 1

0

Okay figured it out, I was running the "detectMultiScale" in a seperate thread and trying to load the haarcascade file in the main ViewDidLoad.

Moved the load within the thread doing the actual detection and it seemed to fix it.

Still not sure why previous versions were not effected though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.