10#include "JunoDistortionMap.h"
76 QString odk0 =
"INS" +
toString(naifIkCode) +
"_DISTORTION_K0";
84 QString odk1 =
"INS" +
toString(naifIkCode) +
"_DISTORTION_K1";
86 QString odk2 =
"INS" +
toString(naifIkCode) +
"_DISTORTION_K2";
87 p_odk.push_back(
p_camera->Spice::getDouble(odk2) / (p2 * p2));
117 double r2 = (ux * ux) + (uy * uy);
159 double r2 = (dx * dx) + (dy * dy);
166 bool converged =
false;
168 int maximumIterations = 15;
169 double tolerance =
p_camera->PixelPitch() / 100.0;
170 double uxEstimate = dx;
171 double uyEstimate = dy;
174 double xDistortion = 0.0;
175 double yDistortion = 0.0;
179 xDistortion = uxEstimate * dr;
180 yDistortion = uyEstimate * dr;
181 uxEstimate = dx - xDistortion;
182 uyEstimate = dy - yDistortion;
184 if (fabs(uxEstimate - uxPrev) < tolerance &&
185 fabs(uyEstimate - uyPrev) < tolerance ) {
189 if (i > maximumIterations) {
194 r2 = (uxEstimate * uxEstimate) + (uyEstimate * uyEstimate);
CameraDistortionMap(Camera *parent, double zDirection=1.0)
Camera distortion map constructor.
double p_focalPlaneX
Distorted focal plane x.
double p_undistortedFocalPlaneX
Undistorted focal plane x.
std::vector< double > p_odk
Vector of distortion coefficients.
double p_undistortedFocalPlaneY
Undistorted focal plane y.
Camera * p_camera
The camera to distort/undistort.
double p_focalPlaneY
Distorted focal plane y.
virtual void SetDistortion(int naifIkCode)
Load distortion coefficients for JunoCam.
virtual bool SetFocalPlane(double dx, double dy)
Compute undistorted focal plane x/y.
virtual ~JunoDistortionMap()
Destructor.
virtual bool SetUndistortedFocalPlane(double ux, double uy)
Compute distorted focal plane x/y.
JunoDistortionMap(Camera *parent)
Juno JunoCam distortion map constructor.
This is free and unencumbered software released into the public domain.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.