Edit: The most recent version is now maintained at http://kyle.googlecode.com/.
ofxCvHaarFinder is for quickly finding features in an image using haar-like features. This is built into OpenCV, but usage is slightly complicated… hence this wrapper.
This wrapper was originally developed by charlie_e, based on an example by stefanix. I rewrote all the code and added some more features.
I spoke with stefanix, and it seems like this would fit with ofxOpenCv but isn’t quite ready yet. To avoid creating YAA (yet another addon ) I’m going to support/update this code in this thread for now. Download the code and add it to your ofxOpenCv/src.
For Haar cascades that can be used with this addon, I’ve found two really good compilations:
1 OpenCV, which can be downloaded via SVN from here: http://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/tags/latest-tested-snapshot/opencv/data/haarcascades
haarcascade_eye.xml
haarcascade_eye_tree_eyeglasses.xml
haarcascade_frontalface_alt.xml
haarcascade_frontalface_alt2.xml
haarcascade_frontalface_alt_tree.xml
haarcascade_frontalface_default.xml
haarcascade_fullbody.xml
haarcascade_lowerbody.xml
haarcascade_profileface.xml
haarcascade_upperbody.xml
2 Modesto Fernando Castrillón Santana from University of Las Palmas de Gran Canaria, which can be downloaded here: ftp://mozart.dis.ulpgc.es/pub/Software/HaarClassifiers/FaceFeaturesDetectors.zip
ojoD/right eye
nariz nuevo/nose new
nariz/nose
mouth
ojoI/left eye
HS/head and shoulders
parojosG/big eye-pair
parojos/eye-pair
Some links regarding this addon:
Origin: http://forum.openframeworks.cc/t/opencv-functions/432/0
Old bugs: http://forum.openframeworks.cc/t/strange-bug-with-haar-finder-and-opencv-1.1pre/1853/0
The OpenCV function itself: http://www.comp.leeds.ac.uk/vision/opencv/opencvref-cv.html#decl-cvHaarDetectObjects
Using this code requires something like this:
ofxCvHaarFinder finder;
finder.setup("face.xml");
finder.findHaarObjects(img); // an ofxCvGrayscaleImage
for(int i = 0; i < finder.blobs.size(); i++) {
ofxCvBlob cur = finder.blobs[i];
printf("found: %i, %i %ix%i\n",
cur.x, cur.y, cur.width, cur.height);
}
The attachment is newer than the last one I posted. It implements the copy constructor and correctly deallocates memory.