LSM_jacobian_g1_g2 for least squares matching Xm = LSM_62_sym_jacobian_g_h(fe,fes,g,h,yi,zi,A,R,pt) fe = estimated image fes = smoothed image g,h = observations of image zyi,zi = list of observed pixels A = actual estimates for geometric transformation R = actual estimates for radiometric transformation pt boolean for plot/print
0001 % LSM_jacobian_g1_g2 for least squares matching 0002 % 0003 % Xm = LSM_62_sym_jacobian_g_h(fe,fes,g,h,yi,zi,A,R,pt) 0004 % 0005 % fe = estimated image 0006 % fes = smoothed image 0007 % g,h = observations of image 0008 % zyi,zi = list of observed pixels 0009 % A = actual estimates for geometric transformation 0010 % R = actual estimates for radiometric transformation 0011 % pt boolean for plot/print 0012 0013 function Xm = LSM_62_sym_jacobian_g_h(fe,fes,g,h,yi,zi,A,R,pt) 0014 0015 % number of observations 0016 Kg = size(1,yi); 0017 Kh = size(1,zi); 0018 0019 NN=Kg+Kh; 0020 NU=6; 0021 0022 Xm=zeros(NN,NU); 0023 0024 fak = 1+R(1); 0025 faki = 1/fak; 0026 0027 %% Jacobians: first image 0028 for k = 1:Kg 0029 i=yi(1,i); % pixel coordinates in g 0030 j=yi(2,i); 0031 xh = A*[i;j;1]; % real coordinates in f (centred) 0032 x=xh(1); 0033 y=xh(2); 0034 fij = LSM_f_spline(x,y,fe); % estimated signal 0035 fxij = LSM_fx_spline(x,y,fes); % gradient at smoothed signal 0036 fyij = LSM_fxy_spline(x,y,fes); 0037 % Jacobian 0038 Xm(k,:) = [fxij*x fyij*x fxij*y fyij*y fxij fyij -fij*faki -fak]*faki; 0039 end 0040 0041 0042 0043 % second image: gradients averaged 0044 for k=Kg+1:Kg+Kh; 0045 i=zi(1,i); % pixel coordinates in h 0046 j=zi(2,i); 0047 xh = Ai*[i;j;1]; % real coordinates in f (centred) 0048 x=xh(1)+Nh; 0049 y=xh(2)+Nh; 0050 fij = LSM_f_spline(x,y,fe); % estimated signal 0051 fxij = LSM_fx_spline(x,y,fes); % gradient at smoothed signal 0052 fyij = LSM_fy_spline(x,y,fes); 0053 pij = Ai'*[fxij;fyij]; % gradient in f 0054 pxij=pij(1); 0055 pyij=pij(2); 0056 Xm(k,:) = -[pxij*x pyij*x pxij*y pyij*y pxij pyij -pij*faki -paki]*fak; 0057 end 0058 0059 0060 return