% condition points, determine conditioning matrix [xc,M] = sugr_condition_Points(x) x = struct, unconditioned points, non-homogeneous coordinates x.e = coordiantes, Cartesian x.Cee = covariance matrices xc = struxt: conditioned SURG-points x.h = homogeneous coordiantes x.Crr = covariance matrices of reduced coordiantes x.e = nonhomogeneous coordiante x.Cee = covariance matrices of x.e M = matrix of conditioning see PCV (6.137), but sigma*sqrt(dim) instead of max Wolfgang Förstner 2/2013 wfoerstn@uni-bonn.de
0001 %% condition points, determine conditioning matrix 0002 % 0003 % [xc,M] = sugr_condition_Points(x) 0004 % 0005 % x = struct, unconditioned points, non-homogeneous coordinates 0006 % x.e = coordiantes, Cartesian 0007 % x.Cee = covariance matrices 0008 % 0009 % xc = struxt: conditioned SURG-points 0010 % x.h = homogeneous coordiantes 0011 % x.Crr = covariance matrices of reduced coordiantes 0012 % x.e = nonhomogeneous coordiante 0013 % x.Cee = covariance matrices of x.e 0014 % M = matrix of conditioning 0015 % 0016 % see PCV (6.137), but sigma*sqrt(dim) instead of max 0017 % 0018 % Wolfgang Förstner 2/2013 0019 % wfoerstn@uni-bonn.de 0020 0021 function [xc,M] = sugr_condition_Points(x) 0022 0023 % number and dimension 0024 [N,d] = size(x.e); 0025 xc = x; 0026 0027 % mean and scale 0028 xm = mean(x.e); 0029 C = cov(x.e); 0030 sigma = sqrt(d) * sqrt(trace(C)/d); 0031 0032 % conditioning-matrix 0033 M = [eye(d) -xm';... 0034 zeros(1,d) sigma]; 0035 %M= eye(d+1); 0036 0037 % condition point coordiantes 0038 for n=1:N 0039 xhn = [x.e(n,:) , 1]'; % homogeneous coord. 0040 Chhn = [squeeze(x.Cee(n,:,:)) zeros(d,1); zeros(1,d+1)]; 0041 xcn = M * xhn; % homogeneous condit. coord. 0042 Chhcn = M * Chhn * M'; % ... CovM 0043 if d ==2 0044 xen = sugr_Point_2D(xcn,Chhcn); 0045 else 0046 xen = sugr_Point_3D(xcn,Chhcn); 0047 end 0048 xc.h(n,:) = xen.h'; % spherically normalized cond. coord. 0049 xc.Crr(n,:,:) = xen.Crr; % ... reduced CovM 0050 xc.e(n,:) = xcn(1:d)/xcn(d+1); 0051 xc.Cee(n,:,:) = x.Cee(n,:,:)/sigma^2; 0052 end 0053 0054 % cond_x = cond(cov(x.e)) 0055 % cond_xc = cond(cov(xc.h(:,1:d)./(xc.h(:,d+1)*ones(1,d)))) 0056 0057