Random header image... Refresh for more!

Speed +5, Accuracy +3

As I hoped, tweaking the parameters to the function greatly sped up the processing of the face detection.  It’s now acceptably fast.  Not 120 fps fast, but it’s unlikely that faces in video will change that fast.  It’s running probably ten frames a second, which is good enough for what I wanted.  Additionally, the false positives have been cut down quite a bit.  So, here’s what I did:

The key function in face detection is called CvHaarDetectObjects.  It has something to do with Haar Classification and Cascades and all sorts of other technical mumbo jumbo that I don’t really care about at the moment because someone else has already figured it out and written it all for me.  All I know is that I have to call it with some parameters and the function returns to be a list of faces.  (And things that it thinks are faces because it’s delusional and psychotic…)  It’s not strictly a face detector, it’s a generalized object detector, it just happens to be used for detecting faces.

The first few parameters are straightforward, the image and storage, etc.  Then you get into less apparent parameters, like “Scale Factor” and “Min Neighbors”.

Scale Factor is how much to increase the size of the scanning window between passes.  I think that translates into something like “Higher numbers run faster wil less accuracy.”

Min Neighbors has something to do with overlaps and multiple detected objects or something like that.  Basically, the higher the number, the fewer false positives you get, but if you set it too high, you risk getting fewer true positives, too.

Then there’s a flag parameter which alters how the operation works.  I used the “Do Canny Pruning” value because that’s what someone else said to do.  Supposedly that value make things run faster and result in fewer false positives.

Finally, there’s Min Size.  That’s the size of the scan window to use, which translates roughly to the smallest object you expect to find.  The smaller the window the more things you’ll pick up, but at the expense of speed.

Right now, I’m calling the following and it seems to be doing a pretty good job:

CvSeq sequence = _classifierCascade.HaarDetectObjects(image, _memStorage, 1.2, 30, HaarDetectionType.DoCannyPruning, new CvSize(40, 40));

Now, it’s on to acquiring the training images…

0 comments

There are no comments yet...

Kick things off by filling out the form below.

Leave a Comment