42 QString odkkey =
"INS" +
toString(naifIkCode) +
"_DISTORTION_COEFFS";
44 for(
int i = 0; i < 4; i++) {
69 double radialDist2 = (dxPix * dxPix) + (dyPix * dyPix);
71 if(radialDist2 <= 1.0
E-3) {
78 double radialDist4 = radialDist2 * radialDist2;
79 double radialDist6 = radialDist4 * radialDist2;
81 double uRadialDist =
p_odk[0] + radialDist2 *
p_odk[1] +
82 radialDist4 *
p_odk[2] +
83 radialDist6 *
p_odk[3];
86 double uxPix = dxPix * uRadialDist;
87 double uyPix = dyPix * uRadialDist;
116 double dxPix = GuessDx(uxPix);
117 double dyPix = uyPix;
121 double Ru = sqrt((uxPix * uxPix) + (uyPix * uyPix));
132 double Rd = sqrt((dxPix * dxPix) + (dyPix * dyPix));
134 while(fabs(delta) > 1
E-9) {
135 if(fabs(delta) > 1E30 || iter > 50) {
139 double Rd2 = Rd * Rd;
140 double Rd3 = Rd2 * Rd;
141 double Rd4 = Rd3 * Rd;
142 double Rd5 = Rd4 * Rd;
143 double Rd6 = Rd5 * Rd;
147 Rd6 *
p_odk[3] - Ru * (1.0 / Rd);
149 double fRd2 = 2 *
p_odk[1] * Rd +
161 dxPix = uxPix * (Rd / Ru);
162 dyPix = uyPix * (Rd / Ru);
170 double MarciDistortionMap::GuessDx(
double uX) {
172 if(fabs(uX) < 1)
return uX;
175 return (1.4101 * log(fabs(uX)));
178 else if(p_filter == 1) {
179 return (1.1039 * log(fabs(uX)));
182 else if(p_filter == 2) {
183 return (0.8963 * log(fabs(uX)) + 2.1644);
186 else if(p_filter == 3) {
187 return (1.1039 * log(fabs(uX)));
190 else if(p_filter == 4) {
191 return (1.4101 * log(fabs(uX)));
double p_focalPlaneX
Distorted focal plane x.
virtual bool SetFocalPlane(const double dx, const double dy)
Compute undistorted focal plane x/y.
virtual bool SetUndistortedFocalPlane(const double ux, const double uy)
Compute distorted focal plane x/y.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
double p_undistortedFocalPlaneX
Undistorted focal plane x.
Camera * p_camera
The camera to distort/undistort.
Distort/undistort focal plane coordinates.
double PixelPitch() const
Returns the pixel pitch.
const double E
Sets some basic constants for use in ISIS programming.
double p_focalPlaneY
Distorted focal plane y.
double p_undistortedFocalPlaneY
Undistorted focal plane y.
MarciDistortionMap(Camera *parent, int naifIkCode)
Camera distortion map constructor.
Namespace for ISIS/Bullet specific routines.
std::vector< double > p_odk
Vector of distortion coefficients.
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.