OpenCV haarcascade_frontalface检测区域

时间:2014-04-29 14:33:11

标签: c++ opencv face-detection

对于面部检测,我使用了haarcascade_frontalface_alt.xml。

问题是这个算法给了我一个更大的roi,所以矩形捕捉到一些头发和一些背景。有没有解决方案来改变这个矩形的尺寸?

这是haarcascade_frontalface_alt.xml检测到的:

enter image description here

这就是我想要发现的:

enter image description here

1 个答案:

答案 0 :(得分:1)

你不能回答OpenCV这样做是因为它的模型是基于面部图像训练的,就像第一个一样。也就是说,它应该像第一个一样进行面部检测。

相反,考虑将检测到的矩形稍微裁剪一下,无论你想要它的大小。


为了更准确,您可以根据面部特征裁剪面部,如this thread中所述。