Smile Away

Daryl Hannah Daryl Hannah

The picture on the left is the same one I used in the last blog; the input to facial8.py. The picture on the right is the output of facial8.py. As you can see, facial8.py correctly identified my face, eyes, nose, and mouth; just like the last blog, but it also covers only a portion of my mouth. This time I added an xml file for smiles. My "smile" is inside the yellow rectangle; it actually covers my whole mouth. However, I'm not smiling in the picture. A smile is indicated by the lip ends pointing upwards.

Here's the code I used to process my jpeg:

facial8.pyhaarcascade_smile.xml

 

In my second blog (of this series) I said that my plan was to search the smiles xml file for the mouth that was just found in my script. You can see in the processed picture that smile code is different from the mouth code (or the rectangles would be coincident). So I couldn't just search through haarcascade_smile.xml for the mouth that was just detected. Besides, it looks like the smile xml file doesn't work, anyway. I googled "angry face" and came up with this:

In the above pictures you can see that the "smile" is coincident with the mouth (almost), but not exactly the same dimensions; i.e.; a search in the smile file wouldn't find the same list (inside the smile xml file) that we found for the mouth. So the smile xml file isn't the same as the mouth xml file, but so far it has displayed better coverage of the mouths it has found. So lets look at an actual smile (I googled "smile" and got a bunch of pictures of smiles):

Nothing different. It seems that the smile xml file only finds mouths. Maybe there is some trick to using this file. I'll break down and read the documentation for OpenCV. haarcascade_smile.xml comes with the OpenCV package, so there should be some documentation for using it properly. If there is no "trick", I'll just goto plan B; start creating my own haarcascade xml files for the different emotions (a whole lot more work then I originally planned on, so hopefully I'll find a "trick" to using haarcascade_smile.xml properly).

Return To My Blog Page       Return To My Programming Page