function [idf] = IDF(I, d,phi) % % Written by: % -- % John L. Weatherwax 2005-08-04 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % % Epage % %----- if( nargin>1 ) % compute the IDF for just one displacement and angular direction P = co_occurrence(I, d,phi); N_g = size(P,1); iiArray = repmat( (0:(N_g-1))', [1,N_g] ); jjArray = repmat( (0:(N_g-1)) , [N_g,1] ); D = ones(N_g) + (iiArray - jjArray).^2; % compute the denominator PoD = P ./ D; idf = sum(PoD(:)); else % compute the IDF for all angles and average d = 1; % assume d=1 all_phis = [ 0, 45, 90, 135 ]; all_idfs = zeros(1,length(all_phis)); for ii=1:length(all_phis) c = IDF(I, d,all_phis(ii)); % recursively call the three argument case all_idfs(ii) = c; end idf = mean(all_idfs); end