如何限制Haar级联检测到的面部数量 [英] how to limit number of faces detected by haar cascades
问题描述
我在情绪检测系统中使用Haar级联.我提供给模型的每个视频输入都只有一个面孔(这是必需的).当我运行Haar级联模型以检测人脸时,它具有一些误报.由于我的视频中只有一张脸,因此我想检测到最正的区域,而忽略所有其他检测.有没有办法做到这一点?
I am using Haar cascade in an emotion detection system. Every video input I am giving to the model has only one face in it (It is a requirement). When I run Haar cascade model to detect faces, it has some false positives. Since I have only one face in the video, I want to take the most positive area detected and ignore all other detection. Is there a way to do that?
推荐答案
在调用detectMultiScale
函数时,请将minNeighbours
值设置为较高的值,以免出现误报.另外,您可以设置minSize
参数以指定要检测的脸部的最小尺寸.这是我正在使用网络摄像头进行人脸检测的东西.
when you are calling detectMultiScale
function, set the minNeighbours
value to a high value to avoid false positives. Also, you can set the minSize
parameter to specify a minimum size of face to be detected. Here is what I am using for face detection using a webcam.
faces = faceCascade.detectMultiScale(
gray,
scaleFactor=1.2,
minNeighbors=10,
minSize=(64,64),
flags=cv2.CASCADE_SCALE_IMAGE
)
这篇关于如何限制Haar级联检测到的面部数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!