如何实施LBP制服

时间:2016-03-02 12:58:56

标签: opencv descriptor lbph-algorithm

我是OpenCV的新手。我试图做一个样本来提取脸部的特征。我正在评论几篇论文,其中一篇最受推荐的是LBP。我理解如何工作LBP描述符,但我从中读取了一个变体。 LBP制服我理解它是LBP原始的但是一旦你有二进制序列(例如你比较一个特定像素与邻居并且你有下一个结果 - > 11110001,我知道有2个过渡,所以在这种情况下我们可以说它因为转变的数量是<= 2,所以是均匀的。

我的问题是在执行此过程后我必须在该像素中计算什么代码。我知道LBP的原始数据有256个值,但是从LBP统一que的这个变量将数量减少到59个bin值。所以我的问题是,如果每个像素中的转换数是&lt; = 2或&gt; 2,我必须在测试后添加什么代码。

谢谢!我希望我已经正确解释了。

1 个答案:

答案 0 :(得分:4)

here's a lookup-table for this, assuming 8 neighbours:


    static int uniform[256] =
    {  
        0,1,2,3,4,58,5,6,7,58,58,58,8,58,9,10,11,58,58,58,58,58,58,58,12,58,58,58,13,58,
        14,15,16,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,17,58,58,58,58,58,58,58,18,
        58,58,58,19,58,20,21,22,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,
        58,58,58,58,58,58,58,58,58,58,58,58,23,58,58,58,58,58,58,58,58,58,58,58,58,58,
        58,58,24,58,58,58,58,58,58,58,25,58,58,58,26,58,27,28,29,30,58,31,58,58,58,32,58,
        58,58,58,58,58,58,33,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,34,58,58,58,58,
        58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,
        58,35,36,37,58,38,58,58,58,39,58,58,58,58,58,58,58,40,58,58,58,58,58,58,58,58,58,
        58,58,58,58,58,58,41,42,43,58,44,58,58,58,45,58,58,58,58,58,58,58,46,47,48,58,49,
        58,58,58,50,51,52,58,53,54,55,56,57
    };

使用它,你只需用LUT中的那个替换8位lbp值:

    value = uniform[value];