I'm trying to detect mouth in already detected face (detected face => detect mouth), the problem is that it detects eyes as if they are mouth! how do I solve this problem?
BTW I'm using haarcascade_mouth.xml with CV_HAAR_DO_CANNY_PRUNING. Please help me out.
Probably the best thing is to create your own haar cascades for mouths of all types and perspectives:
How to create Haar Cascade (xml) for using with OpenCV?
Then you should apply all of them on your face and accumulate their output on the different regions of the face to decide which outputs overlap the most and fit a rectangle that is most likely the mouth. An even more elegant way of combining these simple classifiers would be boosting (which would require another training step):
http://en.wikipedia.org/wiki/Boosting_%28machine_learning%29
But if you are lazy - why not just putting constraints on the result of the output of the haarcascade_mouth? This would mean that you only accept outputs which are in the lower 50% of the image (y < sizeY/2) and/or only 10 % off center (x > 0.4*sizeX && x < 0.6*sizeX).