简体   繁体   English

Haarcascade只检测面部区域而不是耳朵

[英]Haarcascade detects only face area and not ears

I am using opencv and c++. 我正在使用opencv和c ++。 When I use Haarcascade with the haarcascade_frontalface_alt2.xml file,it detects only the face and not the ears. 当我将haarcascade与haarcascade_frontalface_alt2.xml文件一起使用时,它只检测面部而不是耳朵。 I need the face as well as the ears in one image. 我需要一张图片中的脸部和耳朵。 Can anyone suggest a method for that please? 有人可以建议一个方法吗? Thanks 谢谢

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. 以下是如何训练级联来帮助您的指南。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM