function [sre] = SRE(I, 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 SRE for just one displacement and angular direction Q = Q_RL(I,phi); [N_g,N_r] = size(Q); oneOverJ2 = 1 ./ ( repmat( 1:N_r, [N_g,1] ).^2 ); tmp = Q .* oneOverJ2; num = sum(tmp(:)); den = sum(Q(:)); sre = num/den; else % compute the SRE for all angles and average all_phis = [ 0, 45, 90, 135 ]; all_sres = zeros(1,length(all_phis)); for ii=1:length(all_phis) a = SRE(I,all_phis(ii)); % recursively call the three argument case all_sres(ii) = a; end sre = mean(all_sres); end