-2
我尝试使用wikipedia中的公式实现GLCM方法,但由于matlab索引问题,我有问题来填充我的GLCM。灰度共生矩阵
我也使用NitdepthQuantisation来减少灰度级的数量,但现在我使用全8位。
function [C] = GLCM(img, level, theta, delta)
% Quantisation of the input Image to desired value
imgQ = ImageQuantisation(img, level);
[m n] = size(imgQ);
% Get the number of gray levels
maxGV = max(img(:));
% Create GLCM initial Matrix
C = zeros(maxGV, maxGV);
% Positions
delta_x = ceil(delta*cos(theta));
delta_y = ceil(delta*sin(theta));
%% Find Occurences
for i = delta_x+1:m-delta_x
for j = delta_y+1:n-delta_y
if(imgQ(i, j) == imgQ(i+delta_x, j+delta_y))
C(,) = C(,) + 1;
end
end
end
end
你说什么“指数”问题? – rayryeng
它已经解决了,我更新了代码 – Xeno1987
然后请创建一个答案。人们会感到困惑,因为除非他们进入你的编辑历史,他们不会知道你已经解决了你的问题。要么,要么删除你的问题,如果你没有发现它有用。 – rayryeng