function [con] = CON(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 CON for just one displacement and angular direction P = co_occurrence(I, d,phi); N_g = size(P,1); n=0; con = 0.; %=n^2 * sum(diag(P,n)); since n is zero here for n=1:(N_g-1) con = con + n^2 * sum(diag(P,+n)); % extract and add the super diagonal con = con + n^2 * sum(diag(P,-n)); % extract and add the sub diagonal end else % compute the CON for all angles and average d = 1; % assume d=1 all_phis = [ 0, 45, 90, 135 ]; all_cons = zeros(1,length(all_phis)); for ii=1:length(all_phis) c = CON(I, d,all_phis(ii)); % recursively call the three argument case all_cons(ii) = c; end con = mean(all_cons); end