I have some codes to calculate tamura texture directionality. The code likes that:
function [ Fdir ] = tamura_dir( Im )
[gx, gy] = gradient(Im);
[theta,rho] = cart2pol(gx,gy);
nbins = 125;
rho(rho<.15.*max(rho(:))) = 0;
t0 = theta;
t0(abs(rho)<1e-4) = 0;
rho = rho(:)';
t0 = t0(:)';
Hd = hist(t0, nbins);
(1) nrm = hist(rho(:).^2+t0(:).^2, nbins); ??
(2) fmx = find(Hd==max(Hd));
(3) ff = 1:length(Hd);
(4) ff2 = (ff - fmx).^2;
(5) Fdir = sum(Hd.*ff2)./sum(nrm); ??
(6) Fdir = abs(log(Fdir+eps)); ??
end
The code has three steps;The first two steps are used to computed the gradient and the the histogram of the direction of the gradient. And they are not hard to understand. But I have some confusion in the third step. I write two ?? on the behind of that three sentences.
On the basis of the definition of the tamura texture directionality. The third step should be measuring the sharpness of the histogram that have been obtained on the second step. But the code in the third step are different with the definition .
I don not know what the nrm means and why calculate the histogram of nrm. Any suggestion?