Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS OpenCV haarcascade for other facial emotions

Tags:

ios

opencv

I have been trying OpenCV iOS sample to achieve facial emotion recognition. I got OpenCV sample iOS project 'openCViOSFaceTrackingTutorial' from below link. https://github.com/egeorgiou/openCViOSFaceTrackingTutorial/tree/master/openCViOSFaceTrackingTutorial

This sample project uses 'face detection', it works fine. It uses 'haarcascade_frontalface_alt2.xml' trained model.

I want to use the same project but have haarcascade for other facial emotions like Sad, Surprise. I have been searching for how to train haarcascade for emotions like Sad, Surprise etc. but couldn't find any clue.

Could someone advise me, how to train haarcascade for emotions like Sad, Surprise etc. to use in this sample OpenCV iOS project? Or will there be readymade haarcascade for emotions like Sad, Surprise etc. to use for this iOS sample.

Thanks

like image 651
Stella Avatar asked Dec 01 '16 06:12

Stella


People also ask

What is Haar cascade in OpenCV?

It is quite popular in the computer vision community for being excellent object detectors and classifiers due to the fact that they are lightweight, easy to use, and have a very high inference speed. We will explain to you how HAAR Cascade works and then show you how to perform face detection with HAAR Cascade in OpenCV.

How to use Haar-Cascade XML file for face detection in CV2?

CascadeClassifier method in cv2 module supports the loading of haar-cascade XML files. Here, we need “haarcascade_frontalface_default.xml” for face detection. This is done using the cv2::CascadeClassifier::detectMultiScale method, which returns boundary rectangles for the detected faces (i.e., x, y, w, h).

How to use OpenCV cascade classifier to detect faces?

OpenCV comes with lots of pre-trained classifiers. Those XML files can be loaded by cascadeClassifier method of the cv2 module. Here we are going to use haarcascade_frontalface_default.xml for detecting faces. Initially, the image is a three-layer image (i.e., RGB), So It is converted to a one-layer image (i.e., grayscale).

Can OpenCV detect faces in images?

Luckily for us, OpenCV can perform face detection out-of-the-box using a pre-trained Haar cascade: Figure 3: An example of detecting faces in images using OpenCV’s pre-trained Haar cascades.


1 Answers

you can read tutorial on how to generate haarcascade file, but generating haarcascade for emotions is not easy task.

I would suggest to extract Mouth and eye from face and using haarcascade and process these rectangles for detecting emotions. you can get gaarcascade for mouth and eye from here . Mouth and Eye are complicated feature so will not work if you will try to find it in whole image, so first find the front face and try to detect mouth and eye within face rectangle only.

There are open source library available on github for emotion detaction, though these are not for ios, you can use similar algorithm to implement in ios.

like image 99
PlusInfosys Avatar answered Oct 05 '22 08:10

PlusInfosys