gusucode.com > 精通Matlab数字图像处理与识别源码程序 > 精通Matlab数字图像处理与识别源码程序/chapter12/code/LBP/dist_LBPHist.m

    function dist = dist_LBPHist(hist1, hist2)
% compute the Chi square statistic distance between 2 LBP histograms

nLBPFea = 59; % nBin


dist = 0;

for iBin = 1:nLBPFea
    dist = dist + (hist1(iBin) - hist2(iBin))^2 / (hist1(iBin)+hist2(iBin)+eps);
%    id dist
end