ofxCvHaarFinder gives OpenCV ERROR

Hi all,

I am new to ofx and new to opencv. On top of that, I just started using XCode… :stuck_out_tongue:
I have tried to make an xcode project for the Haar detection algorithm, I found at http://code.google.com/p/kyle/

I added the the ofxhaar files in the ofxOpenCv/src folder, and it all seems the relevant files are found okay. However, the run and build doesn’t work and I get this message:

Loading program into debugger

Program loaded.
[Switching to process 2102]

OpenCV ERROR: Null pointer (Invalid classifier cascade)
in function cvHaarDetectObjects, /Users/theo/Documents/CODE/__OPENFRAMEWORKS/SANDBOX/COMPILE_LIBRARIES/__openCV/openCV1.1PreCompile/cv/src/cvhaar.cpp(884)
Terminating the application…
Program received signal: “EXC_BAD_ACCESS”.
sharedlibrary apply-load-rules all
Xcode could not locate source file: cxerror.cpp (line: 359)

Any idea what went wrong?


The haar tracker works with a cascade file that tells it what to look for. It seems that your program is unable to find that file. In my example the file path is as follows:

[PATH TO YOUR PROGRAM]/bin/data/haarcascade_frontalface_default.xml  

Just replace the brackets with your program’s file path. Put the cascade in the right place and all should be well.

Hope that helps.

Perfect!! :smiley:

Thank you!!