Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overlapping face detection in OpenCV

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

like image 546
guneykayim Avatar asked Nov 02 '22 16:11

guneykayim


1 Answers

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.

like image 172
GilLevi Avatar answered Dec 15 '22 21:12

GilLevi