Pregunta

I am using opencv and c++. When I use Haarcascade with the haarcascade_frontalface_alt2.xml file,it detects only the face and not the ears. I need the face as well as the ears in one image. Can anyone suggest a method for that please? Thanks

¿Fue útil?

Solución

The cascade was trained for faces and not ears, so what you are seeing is "normal".

  • If you want detect faces that include ears also, then you can simply expand the face rectangle by some percentage of their width in order to retain them in the crop;
  • or if you want to really only detect the ears, then you have to train your own cascade. Like for the eyes, you wold need to apply face detection first in order to reduce the number of false positives. Here is a guide on how to train a cascade to help you.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top