Ask Your Question

Facial feature detection

asked 2012-07-13 05:12:26 -0500

AngelLeliel gravatar image

updated 2012-07-13 11:18:39 -0500


I can detect the human faces with OpenCV. I would like to detect the accurate locations of facial feature points like eyes and corners of the mouth. Is that possible with OpenCV or other free/open source libraries?

edit retag flag offensive close merge delete

7 answers

Sort by ยป oldest newest most voted

answered 2012-07-13 10:48:41 -0500

Kirill Kornyakov gravatar image

updated 2012-07-13 10:49:32 -0500

Haar cascades can be found here: Also check this tutorial: But if you're going to train your own, you should prefer LBP features, check this guide.

But you should understand that detector returns you only a rectangle, not exact positions of eye/mouth corners. For this you should use something like ASM or AAM. Here is a couple of implementations:

edit flag offensive delete link more


Thanks, I will survey the ASM/AAM solution.

AngelLeliel gravatar imageAngelLeliel ( 2012-07-13 11:17:27 -0500 )edit

i've the same problem but i'm using JAVA is there a possibility that i use AAM with JAVA ???thx

RossMine gravatar imageRossMine ( 2013-05-29 13:21:23 -0500 )edit

did you get this working?? can you share any code?

super_man1993 gravatar imagesuper_man1993 ( 2015-11-14 05:50:05 -0500 )edit

answered 2012-07-13 06:28:07 -0500

You can use HaarCascades for eyes, nose, mouth, ears, face, etc detection. And by that you can get the position of the facial features.

edit flag offensive delete link more


how can i do this and having the corner points

RossMine gravatar imageRossMine ( 2013-05-29 13:19:21 -0500 )edit

@jayrambhia is it real-time? how fast it is?

Aj-611 gravatar imageAj-611 ( 2016-01-26 22:03:51 -0500 )edit

answered 2012-10-03 01:41:21 -0500

lightalchemist gravatar image

The Flandmark Facial point detector (with code) can be found here:

It will return you the four corner points of the eyes, corner of mouth, center of nose, and center of face. It does however require you to give it a bounding box of the face so you will probably have to use the Viola Jones face detector in OpenCV (or any other method) to locate the face first, which you are already doing.

I've compiled the code on Ubuntu and it works very well, provided the bounding box you give it is "just right". If it is too tightly cropped it might miss the feature points near the border of the image. For such cases, you can try to extend the border and specify the bounding box as the "inner" image (excluding border) and sometimes it works. On the other hand when the bounding box is too large it might converge to some nonsense points. But on the whole it works really well, even on rotated faces, faces with glasses, and those that are close to side profile.

edit flag offensive delete link more


can you share code?

cooler333 gravatar imagecooler333 ( 2014-10-27 09:56:34 -0500 )edit

the method can perform real-time @lightalchemist ?

Aj-611 gravatar imageAj-611 ( 2016-01-26 22:02:42 -0500 )edit

answered 2013-01-08 10:27:35 -0500

This paper shows how to detect the eyes.

Bolme, D.S. "Average of Synthetic Exact Filters", IEEE Conference on Computer Vision and Pattern Recognition, 2009. CVPR 2009. PDF and C source code

edit flag offensive delete link more

answered 2013-08-21 04:53:47 -0500

abhi21 gravatar image

In my opinion you should try Shi and Tomasi corner-detector to detect mouth corners. I think OpenCV has the API for it. HaarCascades won't give you mouth corner points, it would only return you a rectangular region that has mouth. OR as pointed out by Kirill use can also use AAM/ASM to detect face features.

edit flag offensive delete link more

answered 2013-08-28 02:47:05 -0500

Sameer gravatar image

Hi, i have try demo for facial feature using It good for points detection but now i did not know how to manipulate the points.

edit flag offensive delete link more

answered 2016-05-19 22:44:26 -0500

There's a nicetutorial here:

edit flag offensive delete link more

Question Tools



Asked: 2012-07-13 05:12:26 -0500

Seen: 25,908 times

Last updated: Aug 28 '13