...for emotions detection. A while back (I don't have a lot of time to work on this, so it takes a while to get from one conclusion to another) I said that the C++ program I found on the Internet for smile detection was comparing the data it got from an image with the data in the haarcascade xml file. I then went through the code and looked up the C++ definitions of the OpenCV functions it was using; I was wrong in my cursory apraisal, and added a note that what the program was doing was comparing the number of hits it was getting on the xml file to the first time it got a smile hit, and using the ratio to state how good of a smile the image was ("is" for the real-time capture off of a webcam) displaying. To get to this depth of understanding I had to read some more documentation:
Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles.
Parameters: |
|
---|
If you look at the code for creating these marked up videos (click on the link below the videos) you'll see that I didn't require any minNeighbors; i.e., any hit on smiling data in haarcascade_smile.xml will bring up that blue rectangle on the left side of the video. ...but, all those green rectangles you see in the video are hits (they have to be in the face region to get the blue rectangle moving) and some of them land in hair, the eyes, etc. I let the hits occur anywhere in the image, and hits occured in the sky,etc. When I first tried detecting smiles I restricted the hit area to the mouth; worked when I smiled in my videos (and those weren't even real smiles) but it missed smiles in the video of smiling celebrities. The celebrity smiles just weren't in haarcascade_smile.xml What I could do is restrict the smile hits to the face region and require minNeighbors to be 6 (or whatever; I need to play with this). ...or, I could check each hit if it occurs in the eye region, nose region, and the mouth region (those are the only regions my Python program looks for). I'm going to try the face region first, and set minNeighbors to 6; my next blog post will follow that coding.