function [rp] = RP(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 RP for just one displacement and angular direction Q = Q_RL(I,phi); num = sum(Q(:)); den = prod( size(I) ); % the total number of pixels in the original image rp = num/den; else % compute the RP for all angles and average all_phis = [ 0, 45, 90, 135 ]; all_rps = zeros(1,length(all_phis)); for ii=1:length(all_phis) a = RP(I,all_phis(ii)); % recursively call the three argument case all_rps(ii) = a; end rp = mean(all_rps); end