简体   繁体   English

OpenCV haarcascade_frontalface检测区域

[英]OpenCV haarcascade_frontalface detection region

For face detection I have used the haarcascade_frontalface_alt.xml. 对于面部检测,我使用了haarcascade_frontalface_alt.xml。

The problem is that the this this algorithm gives me a roi a little bit larger so the rectangle catches some hair and some of the background. 问题是,此算法使我的投资回报率略大,因此矩形抓住了一些头发和某些背景。 Is there a solution to change the dimension of this rectangle? 有解决方案来更改此矩形的尺寸吗?

This what the haarcascade_frontalface_alt.xml detects: haarcascade_frontalface_alt.xml会检测到以下内容:

在此处输入图片说明

And this what I want to detect: 这就是我想检测的:

在此处输入图片说明

You cannot reply on OpenCV to do this because its model is trained based on face images just like the first one. 您无法对OpenCV进行回复,因为与第一个一样,它的模型是基于面部图像进行训练的。 That is to say, it is supposed to give face detections like the first one. 也就是说,应该像第一个一样进行面部检测。

Instead, consider to crop the detected rectangles a little bit, whatever size you want it be. 取而代之的是,考虑将所检测到的矩形稍微裁剪一下,无论您想要多大。


To be more accurate, you can crop the faces based on the facial features, as discussed in this thread . 为了更加准确,您可以根据面部特征裁剪面部,如本主题中所述

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

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