5

I have a profile face:

enter image description here

and a frontal face image:

enter image description here

Output: aligned profile face with reference to frontal face.

Idea: I just need to know which 3 common points I can take,which will be visible on both faces and then use affineTransform and display the aligned profile face

      OR any other **simple method** of doing so

development envi.:c++ and opencv 2.4.2

what I tried:

  1. haarcascade feature detection(common detection point in both images=eye) ; it wont detect ear in frontal face
  2. OpenCV: Shift/Align face image relative to reference Image (Image Registration) (I get error message)
Community
  • 1
  • 1
Steph
  • 609
  • 3
  • 13
  • 32
  • 1
    in general, the stitcher should work for all kind of images, if features can be extracted and matched correctly. `estimateTransform` returns a `cv::Status` value, can you check that? – Micka Mar 10 '14 at 10:22
  • in the command window,it stops processing the images at "Pairwise matching, time= ". It does not get to estimateTransform – Steph Mar 10 '14 at 12:01
  • What error are you getting? – Liam McInroy Mar 16 '14 at 15:20
  • I corrected it. However,I am not able to continue in the main http://pastebin.com/S2etkzrC – Steph Mar 16 '14 at 15:32
  • @Steph, why don't you detect the some facial landmarks (eyes, nose, chin) using STASM or Flandmark detector? – GilLevi Mar 18 '14 at 15:01

2 Answers2

5

As discussed here by @bytefish, finding the accurate position of the eyes in a given image is far from trivial. The Haar-cascades for finding the eyes in OpenCV produce too many false positive to be useful, moreover this approach won't be robust to image rotation.

You'll need a robust head pose estimation for aligning face images. Here are two most robust ones (with code available):


For example, using the method described in the second paper, you will get more robust features like that are shown in the following images. And these robust features will, in turn, ensure to generate more robust face alignment performance.

enter image description here

enter image description here

Community
  • 1
  • 1
herohuyongtao
  • 49,413
  • 29
  • 133
  • 174
  • thanks for this @herohuyongtao but I need a simpler methodand it may not necessarily be robust – Steph Mar 17 '14 at 03:45
1

If you look for something really simple you can treat your mouth as a line on a planar object and calculate the rotation by the amount of line foreshortening. You should never smile though when you take pictures nor when you write your code.

A much cooler approach though would be to map your face as a texture to a predefined 3D model and rotate it until it correlates best with your profile view.

Of course, the right way to do this is to use a set of different head rotations to train a binary classifier that does only pairwise intensity comparisons as in Lepetit paper.

Vlad
  • 4,425
  • 1
  • 30
  • 39