1

I am working on a MATLAB project which enables the user to do face detection and blur them out.

Built-in functions used:

vision.CascadeObjectDetector

The problem with this function: It only detects frontal faces.

The methods I tried: Use imrotate function in a while loop to rotate the image while the degree is less then 360. So I thought that it would work. I increment the rotation by 23 everytime.

Cons: It doesn't work, it changes the spatial resolution of the image.

Amro
  • 123,847
  • 25
  • 243
  • 454
Steven Wong
  • 11
  • 1
  • 1
  • 7
  • 1
    you should give example image, what rotation value do you expect a face to be detected and the rotated image with degraded quality that prevents the detection. – Shai Nov 19 '14 at 08:03
  • 1
    show example images. If all available pre-trained models fail (you a choice of `FrontalFaceCART`, `FrontalFaceLBP`, and `ProfileFace`), you could always train your own detector: http://www.mathworks.com/help/vision/ref/traincascadeobjectdetector.html. Otherwise you have to perform a preprocessing step to align faces if possible – Amro Nov 19 '14 at 08:20
  • Some related questions: http://stackoverflow.com/q/8798670/97160, http://stackoverflow.com/q/10143555/97160 (recall that MATLAB's implementation of face detection is based on OpenCV) – Amro Nov 19 '14 at 08:28

1 Answers1

0

I have done some experiments in the past, and I have learned that the vision.CascadeObjectDetector using the default frontal face model can tolerate about 15 degrees of in-plane rotation. So I would advise rotating the image by 15 or even 10 degrees at a time, rather than 23.

The problem with training your own detector in this case is the fact that the underlying features (Haar, LBP, and HOG) are not invariant to in-plane rotation. You would have to train multiple detectors, one for each orientation, every 15 degrees or so.

Also, are you detecting faces in still images or in video? If you are looking at a video, then you may want to try tracking the faces. This way, even if you miss a face because somebody's head is tilted, you'll have a chance to detect it later. And once you detect a face, you can track it even if it tilts. Take a look at this example.

Dima
  • 38,860
  • 14
  • 75
  • 115
  • It's an image detection. Just to detect faces in an image, then blur them out. – Steven Wong Nov 20 '14 at 03:24
  • In that case, you are going to have to either rotate the image and call the detector multiple times, or train multiple detectors. Or, if your face is upside down because the image is upside down, you can try to use some other cues, such as detecting the sky, to figure out the correct orientation of the image. – Dima Nov 20 '14 at 20:19