Recognize Face, Eyes and Smile on a Live Image using Python OpenCV

In my last post, I worked on Detecting Face and Eyes in an Image using Python. In this post, I will extend the same functionality, but on a Live Image. Now, Live Image means, it will open the device’s camera(Webcam) and start capturing the image. This is exactly what a makeup app does. It detects the face, eyes, lips, and then allows one to put makeup. Cool right?

Face, Eyes, Smile Detection

In this post, I will just write down the algorithm with a small addition of Smile Detection and Eyeglasses Detection. The previous algorithm was not working well when I used my daughter’s image with glasses. Then I found out that openCV has a couple of other XML files that can be useful. Below is the list of files under “Haarcascades”.

When I was trying to run the algorithm, my daughter caught a glimpse of my face with colorful squares all around. She was super excited and wanted some squares on her face too. That way, I got my another two test cases.

  1. Images with glasses
  2. Detecting multiple faces and features

So now, without spending much time on chitchat, let’s dive directly into my modified version of the Face Detection algorithm.

Now, This algorithm works quite well on a single face. But, if there are multiple faces, it gets a little confused. Oh well, I can live with that!

Face, Eyes & Smile Detection on Multiple Faces

To open a makeup palette and put it nice and clean? That requires another level of perfection. Let’s keep that fun project for some other day!

Here, is the Github link for this project.

Thank You!

0

Leave a Reply

Your email address will not be published. Required fields are marked *