5

First let me give some information about what I'm trying to do.

I'm working on a face verification problem using profile faces, and my first step is face detection. I'm using OpenCV face detector with 'haarcascade_profileface.xml'. The problem is, detector does not find faces consistently. By not consistent I mean, it finds a face in some region, but sometimes it finds the face bigger, sometimes smaller and sometimes both. I want it to find same region as a face all the time.

I'm adding some images to tell my problem better. You can find them here.

What should I do to overcome this multiple face detection in the same area (overlapping face detection)?

The first thing that came into my mind is increasing the minNeighbors parameter, but that causes the detection rate to drop so I don't want to do it. Then I think of applying some image stabilization algorithm on facial images, but I think it will be too expensive. If anyone could give me some advice on overcoming this problem I will be glad.

I should mention that I'm using OpenCV 2.4.5 and I set the minNeighbor parameter to 4, scaleFactor was 1.75 and did not set any size limitation.

Thanks in advance,

Regards,

Güney

guneykayim
  • 5,210
  • 2
  • 29
  • 61

2 Answers2

2

If your'e detecting faces from a video, you can apply a filter on the bounding box to keep the bounding box change smoothly. It will reduce those "inconsistencies" in the face bounding box.

CurrentFrameBoundingBox = a*PrevFrameBoundingBox + (1-a)*DetectedBoundingBox

as a is larger, it will give more weight to the previous frame bounding box and reduce inconsistencies.

You do this for every coordinate in the bounding box.

GilLevi
  • 2,117
  • 5
  • 22
  • 38
  • I'm not using a video but I'm using a camera, so I can apply what you offered. But this generates another problem. Suppose the first 10 faces that are found are bigger and the others are smaller. Then what's gonna happen? If you have a solution for that, I will definitely use your solution :) – guneykayim Aug 16 '13 at 14:37
  • 1
    If the 10 first face are bigger and the others are smaller, then the bounding box will gradually become smaller. However, I assume there isn't a solid behavior - sometimes the face detection bounding box is big and sometimes it's small, but this happens randomly. So basically, the size of the bounding box will be somewhat the same over time. In addition, if you're willing to consider solutions outside of OpenCV, I can recommend the following post which summarizes 48 api's for face detection and recognition: http://blog.mashape.com/post/53379410412/list-of-40-face-detection-recognition-apis – GilLevi Aug 16 '13 at 14:45
  • Well, it sure will converge to a certain size, but until the convergence I might get some useless face images. But still that might work. Thank you very much. – guneykayim Aug 16 '13 at 14:49
  • Do we have any better algorithm than simply using a decaying weight? I don't know what kind of buzzword I should search on google scholar as I'm not particularly familiar with the tracking side of cv. – James Harper Oct 18 '14 at 10:53
0

Maybe you can do a customized meanshift clustering that suits your need on the raw bounding detection boxes. If I recall correctly OpenCV is filtering or clustering these raw results, because the classifier fires multiple times for the same object. If you are not satisfied with the routine in OpenCV you can try other density based clustering methods. Or you can simply take the median of these raw results.

James Harper
  • 480
  • 4
  • 8