function [t] = statxtre(f,scale)
% STATXTURE Computes satatistical measures of texture in an image.
% T = STATXURE(F,SCALE) computes six measures of texture from an image (region) F.
% Parameter SCALE is a 6-dim row vecor whose elements multiply the 6 corresponding elements of T for scaling purposes.
% If SCALE is not provided it defaults to all 1s. The output T is 6-by-1 vector with the following elements:
% T(1) = Average gray level
% T(2) = Average contrast
% T(3) = Measure of smoothness
% T(4) = Third moment
% T(5) = Measure of uniformity
% T(6) = Entropy
if nargin == 1
scale(1:6) = 1;
else % Make sure it's a row vector.
scale = scale(:)';
end
% Obtain historgram and normalize it.
p = imhist(f);
p = p./numel(f);
L = length(p);
% Compute the three moments. We need the unnormalized ones
% from function statmoments. These are in vector mu.
[v,mu] = statmoments(p,3);
% Compute the six texture measures;
% Average gray level.
t(1) = mu(1);
% Standard deviation.
t(2) = mu(2).^0.5;
% Smoothness
% First normalize the variance to [0 1] by
% dividing it by (L-1)^2
varn = mu(2)/(L-1)^2;
t(3) = 1-1/(1+varn);
% Third moment (normalized by (L-1)^2 also).
t(4) = mu(3)/(L-1)^2;
% Uniformity.
t(5) = sum(p.^2);
% Entropy.
t(6) = -sum(p.*(log2(p+eps)));
% Scale the values.
t=t.*scale;
statxtre.rar_regional descriptor_statxtre_亮度_图像纹理_纹理
版权申诉
60 浏览量
2022-07-14
06:51:36
上传
评论
收藏 1KB RAR 举报
朱moyimi
- 粉丝: 64
- 资源: 1万+