Changeset 1115 for trunk/src/phys_XYZ.m
- Timestamp:
- Apr 6, 2022, 8:36:16 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/phys_XYZ.m
r1113 r1115 74 74 Calib.Cx_Cy=[0 0]; 75 75 end 76 if ~isfield(Calib,'kc') 77 Calib.kc=0; 76 kc=[0 0]; 77 if isfield(Calib,'kc') 78 kc(1:numel(Calib.kc))=Calib.kc; 78 79 end 80 % if ~isfield(Calib,'kc2') 81 % Calib.kc2=0; 82 % end 79 83 if isfield(Calib,'R') 80 84 R=(Calib.R)'; 81 % R(3)=-R(3);82 % R(6)=-R(6);83 % R(9)=-R(9);84 85 c=Z0virt; 85 86 cvirt=Z0virt; … … 126 127 Xd=(X-Calib.Cx_Cy(1))/Calib.fx_fy(1); % sensor coordinates 127 128 Yd=(Y-Calib.Cx_Cy(2))/Calib.fx_fy(2); 128 dist_fact=1+ Calib.kc*(Xd.*Xd+Yd.*Yd);% distortion factor, first approximation Xu,Yu=Xd,Yd129 dist_fact=1+kc(1)*(Xd.*Xd+Yd.*Yd);% distortion factor, first approximation Xu,Yu=Xd,Yd 129 130 test=0; 130 131 niter=0; … … 133 134 Xu=Xd./dist_fact;%undistorted sensor coordinates, second iteration 134 135 Yu=Yd./dist_fact; 135 dist_fact=1+Calib.kc*(Xu.*Xu+Yu.*Yu);% distortion factor,next approximation 136 R2=Xu.*Xu+Yu.*Yu; 137 dist_fact=1+kc(1)*R2+kc(2)*R2.*R2;% distortion factor,next approximation 136 138 test=max(max(abs(dist_fact-dist_fact_old)))<0.00001; % reducing the relative error to 10^-5 forthe inversion of the quadraticcorrection 137 139 niter=niter+1;
Note: See TracChangeset
for help on using the changeset viewer.