0
我知道這看起來不知何故與代碼錯誤和開發無關,但 我想知道是否有人可以理解這些代碼 積分圖像和本地二進制模式,並告訴我他們如何影響生成的直方圖。積分圖像如何影響局部二進制模式或中心對稱局部二進制模式的結果
在使用積分圖像之前,輸出直方圖是正常的,但在應用積分圖像方法後,我發現大部分直方圖都變爲零。爲了澄清事情,使用積分圖像的預期益處是加速方法的過程。事實上,我之前沒有看到這個,因爲我第一次嘗試它。有誰知道這個可以幫助我嗎?
這些是每個方法的代碼:
積分圖像
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