Ask Your Question
0

Face detection with HAAR Classifier

asked 2016-09-08 09:56:06 -0600

alecs26 gravatar image

Hi,

I am trying to detect face features of people while using a webcam. I used HAAR Classifiers with haarcascade_frontalface_alt2.xml. It works well but the main problem I have is that as soon as the person does not front the camera perfectly, the face is not detected. I then tried to detect only the nose with haarcascade_mcs_nose.xml but I have the same problem.

I know this is possible because I saw people implementing this with HAAR classifier but I don't know what I am doing wrong...

I use:

cvtColor(frame, frame_gray, CV_BGR2GRAY);

equalizeHist(frame_gray, frame_gray);

face_cascade.detectMultiScale(frame_gray, faces, 1.1, 2, CASCADE_FIND_BIGGEST_OBJECT | CASCADE_DO_ROUGH_SEARCH, Size(30, 30), Size(200, 200));

Thank you very much !

Alex

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-09-09 06:09:39 -0600

but the main problem I have is that as soon as the person does not front the camera perfectly

There is nothing wrong. Basically a cascade classifier model only detects what it is trained for. Those models are training with only upfront faces, aligned perfectly nice and nicely centered. This is by far a major issue, but if you want a better model, you will need to train one yourself.

edit flag offensive delete link more

Comments

Thank you very much for your answer Steven.

I understand perfectly. I guess I am not the only one with this problem. My question would then be: 1) is there a model/data base available where the faces are trained for different head rotation ? 2) Is there another known method than HAAR classifier that is known to be better ?

Thank you very much,

Alex

alecs26 gravatar imagealecs26 ( 2016-09-09 11:59:01 -0600 )edit

Well

  1. No but there is the possibility to cope for these rotations by rotating your input image and then warping back the detections.
  2. There are techniques like DNN, RCNN, ... that are capable of detecting faces in all kinds of positions, but not sure if a robust implementation is available in OpenCV.

Good luck!

StevenPuttemans gravatar imageStevenPuttemans ( 2016-09-12 03:57:54 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-09-08 09:56:06 -0600

Seen: 399 times

Last updated: Sep 09 '16