10#include "RosettaOsirisCameraDistortionMap.h"
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 ) {
Distort/undistort focal plane coordinates.
double p_focalPlaneX
Distorted focal plane x.
double p_undistortedFocalPlaneX
Undistorted focal plane x.
double p_undistortedFocalPlaneY
Undistorted focal plane y.
double p_focalPlaneY
Distorted focal plane y.
static Vector zeroVector(int size)
Returns a vector of given length that is filled with zeroes.
static Matrix multiply(const Matrix &matrix1, const Matrix &matrix2)
Returns the product of two matrices.
static Matrix zeroMatrix(int rows, int columns)
Returns a matrix with given dimensions that is filled with zeroes.
static double magnitude(const Vector &vector)
Computes the magnitude (i.e., the length) of the given vector using the Euclidean norm (L2 norm).
boost::numeric::ublas::vector< double > Vector
Definition for an Isis::LinearAlgebra::Vector of doubles.
boost::numeric::ublas::matrix< double > Matrix
Definition for an Isis::LinearAlgebra::Matrix of doubles.
static double dotProduct(const Vector &vector1, const Vector &vector2)
Computes the dot product of the given vectors.
void setPixelPitch(double pitch)
Set the pixel pitch for converting from focal plane coordinates to pixel coordinates.
LinearAlgebra::Matrix m_toUnDistortedY
Matrix for computing undistorted Y coordinates.
void setUnDistortedYMatrix(LinearAlgebra::Matrix yMat)
Set the matrix for converting from distorted to undistorted lines.
double focalYToSample(double y)
Convert a focal plane y coordinate to a pixel space sample coordinate.
LinearAlgebra::Matrix m_toUnDistortedX
Matrix for computing undistorted X coordinates.
double m_pixelPitch
Camera pixel pitch for converting focal plane coordinates to pixel coordinates.
double focalXToLine(double x)
Convert a focal plane x coordinate to a pixel space line coordinate.
void setUnDistortedXMatrix(LinearAlgebra::Matrix xMat)
Set the matrix for converting from distorted to undistorted samples.
void setBoresight(double sample, double line)
Set the boresight location for converting from focal plane coordinates to pixel coordinates.
double sampleToFocalY(double sample)
Convert pixel space sample coordinate to a focal plane y coordinate.
virtual bool SetUndistortedFocalPlane(const double ux, const double uy)
Compute distorted focal plane x/y given an undistorted focal plane x/y.
double m_boresightSample
Camera boresight sample coordinate for converting focal plane coordinates to pixel coordinates.
virtual bool SetFocalPlane(const double dx, const double dy)
Compute undistorted focal plane x/y given a distorted focal plane x/y.
double m_boresightLine
Camera boresight line coordinate for converting focal plane coordinates to pixel coordinates.
double lineToFocalX(double line)
Convert pixel space line coordinate to a focal plane x coordinate.
RosettaOsirisCameraDistortionMap(Camera *parent)
Create a camera distortion map.
This is free and unencumbered software released into the public domain.
Namespace for the standard library.