我正在实现Viola人脸检测器,以检测静态图像中的人脸,对于与我训练大小相同的图像来说,它是非常有用的。然而,我不知道人脸检测器是如何工作的多个大小的脸?
如果我的图像的训练大小是24*24,如果我想在检测器窗口( 30*30 )中检测人脸,那么我需要重新确定haar-特征,这样它就可以工作在30*30大小的检测器窗口中,在相同的阈值下工作。
还有一件事,Haar-特征的位置也会随着不同大小的检测器窗口而变化吗?如果是的话,怎么办?
发布于 2013-10-01 20:35:26
假设您代表的是一个在Haar小波中找到的矩形,其中包含x、y、w和h变量,其中x和y表示矩形的左上角相对于检测器的左上角、w的宽度和h的高度。您可以用一个因子s重新计算整个检测器,每个Haar小波矩形都有以下伪码:
for all rectangle i in the Haar wavelet do
tempRectangle = rectangle[i];
tempRectangle.x = tempRectangle.x * s
tempRectangle.y = tempRectangle.y * s
tempRectangle.h = tempRectangle.h * s
tempRectangle.w = tempRectangle.w * s
//Read the pixels contained in tempRectangle region and
//calculate this rectangle's contribution to the feature value
//considering the respective weight of rectangle[i].
end for因此,让我们假设单个Haar-lke特性的基本大小为24x24像素。该特性由两个矩形r1=(10,15,8,4)和r2=(4, 8, 8, 4)组成,其中r=(x,y,w,h)。当您用因子s=1.25重新设置检测器时,这个特征矩形应该变成r1=(12.5, 18.75, 10, 5)和r2=(5, 10, 10, 5)。
https://stackoverflow.com/questions/19096520
复制相似问题