I'm using cv::FaceRecognizer(EigenFaceRecognizer) to recognize my face.
I input 10 images of my face (which is photographed only my face. Not a background and size is 70x70, format is pgm) to train the recognizer.
Then try to predict exactly same photos that I used in training with Face CascadeClassifier and the Recognizer. But none of the photos are recognized as me!
Is there anything wrong?
Yes you are probably doing something wrong, or maybe your input photos are too similar.
You should start with one of the tutorials on using FaceRecognizer, such as in the OpenCV official tutorials or Chapter 8 of the book "Mastering OpenCV". And then to improve your recognition accuracy, follow the recommendations at "http://www.answers.opencv.org/question/15362/opencv-and-face-recognition/" and "http://www.answers.opencv.org/question/5651/face-recognition-with-opencv-24x-accuracy/".
And for further questions about OpenCV, you should post them on "answers.opencv.com" instead of StackOverflow, since that site has official support!
Related
I am using the HOG descriptor, with the default people detector from opencv in python to try detecting people from above. The camera is positioned over a corridor and the descriptor from opencv doesn't have a very good performance, since it doesn't detect people very well and sometimes tracks some painings on the walls. Can anyone help me in understanding how to improve the performace?
So I want to count how many people appear in a facebook profile picture.
Typically there are 0-2 people (sometimes there are 4-5+ but that's more rare).
A sample dataset (and a few tries using python) can be found here:
https://github.com/yoniker/FaceDetect
I've tried different methods, none of them give reasonable results (all of those methods are wrong most of the time),I've tried the following:
-Face detection- http://docs.opencv.org/trunk/d7/d8b/tutorial_py_face_detection.html
It usually doesn't find anyone (that happens at around 75% of the pictures)- and I have tried different Haar filters and parameters.
-Pedestrian Detection http://www.pyimagesearch.com/2015/11/09/pedestrian-detection-opencv/
Again it doesn't find people most of the time.
OpenFace:Probably this face recognition algo doesn't truly help with face detection (see https://groups.google.com/forum/#!topic/cmu-openface/X6erXKckk0Q).
And finally I've looked at different StackOverflow questions such as
Count the number of people in the video but none of them are relevant!
I've tried for half a day now- so help will be super appreciated!!
For me, dlib has given better results than using OpenCV's haar face detector. It has python bindings too. You can find quick-start code to do face detection here.
It would be possible to help better if you post an Image in which faces are not detected properly.
Having said that, to improve face detection apart from using dlib, you can experiment with these ideas:
Use histogram equalisation(equalizeHist on opencv) on gray scale image before passing it to face detector. (i.e preprocess your images)
If faces are tilted to left or right, more often face detection fails. To solve this rotate the images in steps of 5 degrees upto 30 degrees and apply face detection. At each rotation you might detect new faces.
Most face detectors which are not using deep learning detect mostly frontal faces. Not much could be done about this apart from using deep learning or train your own side profile face detector using HOG or HAAR features.
Hope this helps you to improve your face detection.
There's always the cascade classifier in OpenCV for all your face detection needs. If you could feed it with some nice features it would give you all the results.
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
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.
May be this sounds like a stupid one, but i really curious to know that, what is the difference between "Face Detection and Face Recognition" in iOS perspective? And in what case or which kind of situation should i use the two of them. I am new in iOS and have never any previous tinkle down experience about iOS face Detection/Recognition related thing. I am going to make an application, where i have to detect user face (by camera, not after taken photo) with database picture collection. Please give you response if any, and please don't misunderstand my question. O:)
-Thanks a lot in advanced.
In General:
Face Detection:
Detect the face in the image. It searches general human face like segment in the whole image. Output may be one or more than one. The output will be a rectangle or rectangles on the faces in the image.[Paul viola method]
Face Recognition:
Recognize input face from the already trained database with highest match score. A single face should be given as input, and the output will be a name, or class name or unknown face.
[PCA, LDA]
iOS has face detection, but no face recognition. It can tell you where the faces are in an image but can't tell you who they are.
If you want to use the face detection, start with AVMetadataFaceObject or a tutorial like this one.
I am very new to opencv and able to install it so far. I want to compare a face with other different faces available in library and to find out the closest match. I have tried different features but couldn't find the closer answer.
Any suggestion to choose a detector.
dimensions of input image and images in library are same.
thanks in advance
i think, you want face recognition (who is it?), not detection (is it a face?).
look here for what opencv has to offer there