c# - how to decide face feature after detecting face and mouth using emgucv -
i working on emotion detection in c#, using emgucv , haarcascades xml detected face mouth , eyes, how decide emotion on face detection using code
var faces = grayframe.detecthaarcascade( haar, 1.4, 4, haar_detection_type.do_canny_pruning, new size(nextframe.width / 8, nextframe.height / 8) )[0]; foreach (var f in faces) { image.draw(f.rect, new bgr(color.blue), 2); gray.roi = f.rect; var mouthsdetected = gray.detecthaarcascade(mouth, 1.1, 10, emgu.cv.cvenum.haar_detection_type.do_canny_pruning, new size(20, 20)); gray.roi = rectangle.empty; foreach (var m in mouthsdetected [0]) { rectangle mouthrect = m.rect; mouthrect.offset(f.rect.x, f.rect.y); image.draw(mouthrect , new bgr(color.red), 2); }
}
i found code here. can suggest should have find feature of faces.
the easy solution pre-trained classifier "smile detector".
string smile_cascade_name = "haarcascades\haarcascade_smile.xml";
i don't remember if "haarcascade_smile.xml" come emgu. if not, come opencv source code. https://github.com/opencv/opencv/tree/master/data/haarcascades
the hard 1 train yourself. pretty involving. can go imagenet download smile picture, sad picture , other emotion, train opencv's build-in "opencv_traincascade" function.http://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html. spends me 2 weeks train 1 classifier.
you can use xml trained opencv in emgu code.
Comments
Post a Comment