简体   繁体   English

OpenCV Haar分类器阈值

[英]OpenCV Haar Classifier Threshold

I'm trying to understand the oepncv XML haar classifier which looks like this: 我试图理解oepncv XML haar分类器,它看起来像这样:

      <_>
      <!-- tree 0 -->
      <_>
        <!-- root node -->
        <feature>
          <rects>
            <_>3 7 14 4 -1.</_>
            <_>3 9 14 2 2.</_></rects>
          <tilted>0</tilted></feature>
        <threshold>4.0141958743333817e-003</threshold>
        <left_val>0.0337941907346249</left_val>
        <right_val>0.8378106951713562</right_val></_></_>

As mentioned in the original paper, the threshold should be compared with the sum of a feature (integral image). 如原始论文中所述,应将阈值与特征(积分图像)的总和进行比较。 However, the pixel values of the image should be 0 - 255 (grey scale image). 但是,图像的像素值应为0 - 255(灰度图像)。 How could the sum of a feature be that small (eg in this feature, the threshold is 0.004014...)? 一个特征的总和怎么可能那么小(例如在这个特征中,阈值是0.004014 ......)? Can you guys give me some directions to understand that? 你们能给我一些指导来理解吗?

Thank you for your help! 谢谢您的帮助!

This problem has been solved. 这个问题已经解决了。 The paper that opencv team published to implement this algorithm has mentioned that they actually normalized the pixels using the following equation: opencv团队发布的用于实现该算法的论文提到他们实际上使用以下等式对像素进行归一化:

Pixel = (Pixel_old - average)/(2*sigma)

Pixel is the normalized value for each pixel, Pixel_old is the original integer value (0-255) average is the average of the detection window( it should be a 20*20 window) sigma is the standard deviation of the pixels in 20*20 window. 像素是每个像素的归一化值,Pixel_old是原始整数值(0-255)平均值是检测窗口的平均值(它应该是20 * 20窗口)西格玛是20 * 20像素的标准差窗口。

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

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