【问题标题】:How integral image influence the result of local binary pattern or center symmetric local binary pattern积分图像如何影响局部二值模式或中心对称局部二值模式的结果
【发布时间】:2017-02-17 01:37:36
【问题描述】:

我知道这看起来与代码错误和开发无关,但是 我想知道是否有人可以理解这些代码 积分图像和局部二进制模式,并告诉我它们如何影响生成的直方图。

在使用积分图之前,输出的直方图是正常的,但是在应用积分图方法后,我发现大部分直方图都变为零了。澄清一下,使用积分图像的预期好处是加快 lbp 方法的处理。事实上,我以前没有见过这个,因为我是第一次尝试。有知道这方面的人可以帮帮我吗?

这些是每个方法的代码:

整体形象

function [outimg] = integral( image )
[y,x] = size(image);
outimg = zeros(y+1,x+1);
disp(y);
for a = 1:y+1
    for  b = 1:x+1
        rx = b-1;
        ry = a-1;
        while ry>=1
            while rx>=1  
                outimg(a,b) = outimg(a,b)+image(ry,rx);
                rx = rx-1;
            end
            rx = b-1;
            ry = ry-1;
        end
        % outimg(a,b) = outimg(a,b)-image(a,b);
    end   
end
% outimg(1,1) = image(1,1);
disp('end loop');
end

CS-LBP

function h = CSLBP(I)
%% this function takes patch or image as input and return Histogram of
%% CSLBP operator. 
h = zeros(1,16);
[y,x] = size(I);
T = 0.1; % threshold given by authors in their paper
for i = 2:y-1
    for j = 2:x-1
        % keeping I(j,i) as center we compute CSLBP
        % N0 - N4
        a = ((I(i,j+1) - I(i, j-1) > T ) * 2^0 );        
        b = ((I(i+1,j+1) - I(i-1, j-1) > T ) * 2^1 );
        c = ((I(i+1,j) - I(i-1, j) > T ) * 2^2 );
        d = ((I(i+1,j-1) - I(i - 1, j + 1) > T ) * 2^3 );
        e = a+b+c+d;
        h(e+1) = h(e+1) + 1;
    end
end
end

【问题讨论】:

    标签: matlab matlab-figure matlab-guide matlab-cvst matlab-deployment


    【解决方案1】:

    Matlab 有一个用于创建积分图像的内置函数,integralimage()。如果您不想使用计算机视觉系统工具箱,您可以通过调用来获得相同的结果:

    IntIm = cumsum(cumsum(double(I)),2);
    

    如果需要,可能会添加填充。您应该检查图像是否饱和,他们有时会这样做。计算累积和很快就会超过 uint8 和 uint16 范围的整数,我什至遇到过一次双精度数!

    【讨论】:

      猜你喜欢
      • 2020-11-09
      • 1970-01-01
      • 2016-06-28
      • 1970-01-01
      • 2011-11-16
      • 1970-01-01
      • 1970-01-01
      • 2015-10-20
      • 2016-03-02
      相关资源
      最近更新 更多