function [argout1,argout2] = dummy(a,b,exponent) Steve Mann, 1991 % motion from fft2 2-D version % fast conv; see how much image is shifted over % motion_estimation by fft methods: cross spectrum, CROSS SPECTRUM % % [m,n] = est_trans_fft2(A,B); % estimates motion % p = est_trans_fft2(A,B); % puts in p vector % % p = est_trans_fft2(A,B,.5); % uses alternate exponent in the division by % % the magnitude (default is 1; Girod phase only) % % exponent should be chosen from 0 (autocorrelation) to 1 (phase only) % % experiments on using [m,n]=est_trans_fft2(A,B) as a motion estimator show: % exponents from 0 to .3 give the same wrong answer % exponents from .5 to 1 generally give the same right answer % .4 gave one wrong answer; .45 another wrong answer % .49 gave right answer % % Example application: [m,n]=est_trans_fft2(A,B); % pchirp2(pinverse([1 0 m/M 0 1 n/N 0 0]),B); % look like A % % p_trans=est_trans_fft2(A,B); % pchirp2(p_trans,B); % look like A % % p=est_pchirp2(A,B,p_trans); % starting guess % B=pchirp2(p,B); % B almost exactly like A by now % % Calls: motion_cross_fft2 (then selects location of peak) % % Bugs: RUNS REALLY SLOW IF THERE IS NaN IN DATA (due to bug in Matlab's FFT) % workaround by using: est_trans_fft2(A,chnan(B,mean2nan(B))), or the like if nargin < 3 disp('est_trans_fft2: exponent defaulting to 1, so we have phase only') exponent = 1; end%if [M,N]=size(a); [Mb,Nb]=size(b); if (M~=Mb) error('est_trans_fft2: image heights differ') end%if if (N~=Nb) error('est_trans_fft2: image widths differ') end%if q = motion_cross_fft2(a,b,exponent); [trash m n]=max2(q); if (m-1) < (M/2) m = m - 1; else%if (m-1) >= (M/2) m = (m-M) - 1; end%if if (n-1) < (N/2) % works for even or odd image sizes (also works for n=1) n = n - 1; else%if (n-1) >= (N/2) n = (n-N) - 1; end%if if nargout == 0 disp('est_motion_fft2: no output arg. given so displaying results to screen') end%if if nargout == 1 disp('est_motion_fft2: 1 output arg. given so generating p vector') %argout1 = [1 0 m/M 0 1 n/N 0 0]; argout1 = pinverse([1 0 m/M 0 1 n/N 0 0]); end%if if nargout == 2 disp('est_motion_fft2: 2 output args. given so generating m and n') argout1 = m; argout2 = n; end%if