10 #include "RosettaOsirisCameraDistortionMap.h"
24 RosettaOsirisCameraDistortionMap::RosettaOsirisCameraDistortionMap(
Camera *parent) :
80 xTerms(2) = dxPixel*dxPixel;
81 xTerms(3) = dxPixel*dxPixel*dxPixel;
86 yTerms(2) = dyPixel*dyPixel;
87 yTerms(3) = dyPixel*dyPixel*dyPixel;
146 double tolerance = 1e-7;
148 int maxIterations = 20;
152 undistortedCoordinate(0) = uxPixel;
153 undistortedCoordinate(1) = uyPixel;
171 xTerms(1) = distortedCoordinate(0);
172 xTerms(2) = distortedCoordinate(0)*distortedCoordinate(0);
173 xTerms(3) = distortedCoordinate(0)*distortedCoordinate(0)*distortedCoordinate(0);
176 yTerms(1) = distortedCoordinate(1);
177 yTerms(2) = distortedCoordinate(1)*distortedCoordinate(1);
178 yTerms(3) = distortedCoordinate(1)*distortedCoordinate(1)*distortedCoordinate(1);
181 delXTerms(2) = 2.0*distortedCoordinate(0);
182 delXTerms(3) = 3.0*distortedCoordinate(0)*distortedCoordinate(0);
185 delYTerms(2) = 2.0*distortedCoordinate(1);
186 delYTerms(3) = 3.0*distortedCoordinate(1)*distortedCoordinate(1);
189 objectFuncValue(0) = undistortedCoordinate(0)
192 objectFuncValue(1) = undistortedCoordinate(1)
214 double det = negJacobian(0, 0) * negJacobian(1, 1) - negJacobian(1, 0) * negJacobian(0, 1);
215 if ( fabs(det) < 1e-15 ) {
218 negInvJacobian(0, 0) = negJacobian(1, 1) / det;
219 negInvJacobian(0, 1) = - negJacobian(0, 1) / det;
220 negInvJacobian(1, 0) = - negJacobian(1, 0) / det;
221 negInvJacobian(1, 1) = negJacobian(0, 0) / det;
227 distortedCoordinate += updateStep;
231 xTerms(1) = distortedCoordinate(0);
232 xTerms(2) = distortedCoordinate(0)*distortedCoordinate(0);
233 xTerms(3) = distortedCoordinate(0)*distortedCoordinate(0)*distortedCoordinate(0);
236 yTerms(1) = distortedCoordinate(1);
237 yTerms(2) = distortedCoordinate(1)*distortedCoordinate(1);
238 yTerms(3) = distortedCoordinate(1)*distortedCoordinate(1)*distortedCoordinate(1);
241 delXTerms(2) = 2.0*distortedCoordinate(0);
242 delXTerms(3) = 3.0*distortedCoordinate(0)*distortedCoordinate(0);
245 delYTerms(2) = 2.0*distortedCoordinate(1);
246 delYTerms(3) = 3.0*distortedCoordinate(1)*distortedCoordinate(1);
249 objectFuncValue(0) = undistortedCoordinate(0)
252 objectFuncValue(1) = undistortedCoordinate(1)
257 iteration > maxIterations ) {