Ask Your Question

Face Detect and Cropping

asked 2012-11-05 09:21:22 -0500

UserOpenCV gravatar image

Project: Face Detection

Description: I want to detect and crop a face in an image. The image is captured through webcam and only one face per image.I used OpenCV face detector, but I was not satisfied with the cropping. So, I started using STASM ( face landmark detector to crop the image.STASM uses OpenCV face detector to find face in an image and STASM locates landmarks in faces. In bad light conditions, the cropped image from STASM is not good as it is not exactly detecting the face alone.

1) I want to know any better algorithm for face detection. My main aim is to crop the face from an image.

2) currently I am using STASM for cropping. In bad light conditions or when in an image, if the whole or complete face (forehead to chin) is not captured, STASM cropping is not reliable (The output will be only eye or lips). And in my application, if there is no proper output from the stasm or if the face is not cropped prpoerly then i should reject the images. How to do that? So I am planning to validate the face in an image by finding the Eyes. If I am right in my approach, how to detect the eyes from the cropped image?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2012-11-07 04:10:35 -0500

icedecker gravatar image

updated 2012-11-07 04:11:30 -0500

I suggest two possible approaches:

1 - Manually crop the image (yes, it is time consuming, but at least is "accurate"). Google for some tools, like imageclipper. Or use gimp/related if is few images.

2 - To detect the eyes, you can use the eye classifier available in opencv/data/haarcascades. Or another method, but the eye cascade can help.

About the bad illumination conditions, try to apply some illumination normalization, for example, histogram equalization or gamma correction. The topic here have some suggestions and a reference to a paper.

edit flag offensive delete link more

answered 2013-04-19 18:17:50 -0500

updated 2013-04-19 18:19:16 -0500

Hi, Could you tell me, how did you integrate the stasm library with opencv2.4.4 and visual studio. I am getting linker errors. I have changed the project properties to include the header files, the libraries. I still get unresolved external error for asmsearchdll. I just need few landmark points and asmsearchdll should be fine for my project. could you help me ?

edit flag offensive delete link more


Hi I didnt integrated STASM in Visual Studio. If you want the co-ordinates of an image simply try to execute the opencv sample code which will be in "STASM samples folder" which will give you the co-ordinates. Please post as comment and not as an answer.

UserOpenCV gravatar imageUserOpenCV ( 2013-04-22 11:26:03 -0500 )edit

I apologize for posting as an answer earlier. I did not realize it. Did you use opencv 2.1 to work with stasm 3.1 ?

shobhitkukreti gravatar imageshobhitkukreti ( 2013-04-23 05:27:44 -0500 )edit

Question Tools


Asked: 2012-11-05 09:21:22 -0500

Seen: 2,570 times

Last updated: Apr 19 '13