I have a problem, when i take a photo with my tablet, i use opencv for detecting a face and recognition a face. So i would try to rotate the face in order to have for example the eyes and mounth in the same position for example all with the same horizontal angle.
Can you suggest me some OpenCv functions or some useful links for do this?
Thanks in advance.
Marco
Asked
Active
Viewed 4,326 times
5

Marco Gallella
- 793
- 1
- 11
- 18
1 Answers
10
I think the opencv remapping tutorial might help http://opencv.itseez.com/doc/tutorials/imgproc/imgtrans/remap/remap.html#remap
Full answer:
Use this to locate the eyes cascade_classifier now when you have a point for each eye - build the line equation and use simple trigonometry to find the angle. when you have the angle - use the remap to rotate or even better use this warp_affine

Boaz
- 4,549
- 2
- 27
- 40
-
Hi Jan, what i want is to detect eyes in a image, find the angle respect an horizontal line and rotate the image for having all the face in the same pose. – Marco Gallella Feb 17 '12 at 14:43
-
2use this to locate the eyes http://opencv.itseez.com/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html#cascade-classifier now when you have a point for each eye - build the line equation and use simple trigonometry to find the angle. when you have the angle - use the remap to rotate or even better use this http://opencv.itseez.com/doc/tutorials/imgproc/imgtrans/warp_affine/warp_affine.html#warp-affine – Boaz Feb 17 '12 at 15:03
-
No problem, If it helped, please consider rating the answer and/or accepting it by clicking on the V sign under the answer rank and making it green. – Boaz Feb 17 '12 at 15:14