Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in AI and Deep Learning by (50.2k points)

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 the 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 the OpenCV face detector to find the 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) I am currently 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 copied properly 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?

1 Answer

0 votes
by (108k points)

There are pretty good results in one of the projects by identifying the eyes in the face with a nested cascade classifier, as it is in the delivered example. But then you can use an additional trick in which you have to turn down the minNeighbors parameter of nestedCascade.detectMultiScale() to 0.

That means you get a lot of results. One eye is recognized may times. Then you can check where the results are gathering on the left and the right part of the face. The gathering points are the actual eye positions.

Then you have to rotate the initial Image. Rotation-centre is the center of the face that you have found and rotation-angle is the angle between the detected eyes. Then you have to perform another face detection on the rotated image and make sure you use a very low scale-factor in the parameters of nestedCascade.detectMultiScale() for that.

The result is in most cases a perfectly normalized facial image. Of course, success still depends on how bad your lighting conditions are.

If you wish to learn about Artificial Intelligence then visit this Artificial Intelligence Course.

Browse Categories