|
% 测试软件MATLAB2015b
%灰度共生矩阵 Gray Level Cooccurance Matrices (GLCMs)
glcms = graycomatrix(img);
% 特征求解:对比度、相关性系数、能量、均匀性,例如常用的还有【熵】等
stats = graycoprops(glcms,'Contrast Correlation Energy Homogeneity'); % stats = graycoprops(glcms,'all');
Contrast = stats.Contrast;
Correlation = stats.Correlation;
Energy = stats.Energy;
Homogeneity = stats.Homogeneity;
% 均值、方差
Mean = mean2(seg_img);
Standard_Deviation = std2(seg_img);
% 熵
Entropy = entropy(seg_img);
RMS = mean2(rms(seg_img));
%Skewness = skewness(img)
Variance = mean2(var(double(seg_img)));
a = sum(double(seg_img(:)));
Smoothness = 1-(1/(1+a));
Kurtosis = kurtosis(double(seg_img(:)));
Skewness = skewness(double(seg_img(:)));
% Inverse Difference Movement
m = size(seg_img,1);
n = size(seg_img,2);
in_diff = 0;
for i = 1:m
for j = 1:n
temp = seg_img(i,j)./(1+(i-j).^2);
in_diff = in_diff+temp;
end
end
IDM = double(in_diff);
|
|