% est_transrot.m Steve Mann, 1992 % % 2-D image group parameter est; adapted for Peleg: Steve Mann, 1993 % % transrot (not transrot2 because the 2 is obvious; no such thing as 1D rot) % % estimates parameters of the rigid body motion group % % Use: [b,a] = est_transrot(E1,E2); % complex trans; rot mag=1 % or : [trans_m, trans_n, rot] = est_transrot(E1,E2)% 3 real output arguments % or : est_transrot(E1,E2); % nicely formatted screen % % output in radians + deg % % sign convention: real down, imag to right % % properly handles situation when one or both images contain some NaN points % % Bugs???: Peleg Taylor series of Taylor series still needs to be double-checked function [p1, p2, p3] = multi_parameter_function(E1,E2,K); if nargin==1 disp('est_transrotr: you must supply 2 images') return end%if if nargin ~=3 disp('est_transrotr: number of itterations not specified; defaulting to 2') K=2; end%if a=1; % initialize group parameters b=0; for k = 1:K [b,a] = est_transrot(E1,E2); resample(a,E2,b); end%for trans_m = real(b); trans_n = imag(b); rot = angle(a); if nargout == 3 p1 = trans_m; p2 = trans_n; p3 = rot; end%if if nargout == 2 p1 = trans_m + i*trans_n; % the ``b'' in the ax+b group p2 = exp(i*rot); % the ``a'' in ax+b; contains zoom=1 and rot end%if if nargout == 1 disp('only 1 output argument was given; still need to decide what to do here') disp('i have not decided what to do in the case of 1 output argument') disp('please use either 3,2, or 0 output arguments') return end%if if nargout == 0 % disp('0 output arguments were given so I am displaying result to screen:') o = pi/180; disp(sprintf('trans_m=%g pels; trans_n=%g pels; rot=%g =%go',... trans_m, trans_n, rot, rot/o)) p1 = [trans_m, trans_n, 0, rot, 0,0,0]; % p1 will be returned if user calls % this function without semicolon end%if