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