13#include "NaifStatus.h"
14#include "OsirisRexOcamsDistortionMap.h"
15#include "CameraFocalPlaneMap.h"
47 QString mess =
"FocalPlaneMap must be set in the Camera object prior to"
48 " initiating this distortion model!";
90 odkkey =
"INS" +
toString(naifIkCode) +
"_OD_K";
92 for (
int i = 0; i < 5; ++i) {
101 odcenterkey =
"INS" +
toString(naifIkCode) +
"_OD_CENTER";
105 QString tolKey =
"INS" +
toString(naifIkCode) +
"_TOLERANCE";
108 QString dbKey =
"INS" +
toString(naifIkCode) +
"_DEBUG_MODEL";
126 if (
p_debug )std::cout <<
"\nUndistorting at " << dx <<
", " << dy <<
"\n";
136 if (
p_odk.size() < 2) {
144 if (
p_debug ) std::cout <<
"x0=" << x0 <<
", y0=" << y0 <<
"\n";
149 double xx, yy, r, rr, rrr, rrrr;
150 double xdistortion, ydistortion;
151 double xdistorted, ydistorted;
152 double xprevious, yprevious;
155 xprevious = 1000000.0;
156 yprevious = 1000000.0;
160 bool bConverged =
false;
165 for(
int i = 0; i < 50; i++) {
166 xx = (xt-x0) * (xt-x0);
167 yy = (yt-y0) * (yt-y0);
176 xdistortion = drOverR * (xt-x0);
177 ydistortion = drOverR * (yt-y0);
180 xt = dx - xdistortion;
181 yt = dy - ydistortion;
187 if((fabs(xt - xprevious) <= tolerance) && (fabs(yt - yprevious) <= tolerance)) {
201 m_focalMap->SetFocalPlane(xdistorted, ydistorted);
204 std::cout <<
"Detector sample=" << m_focalMap->DetectorSample()
205 <<
", line=" << m_focalMap->DetectorLine()<<
"\n";
208 if (
p_debug ) std::cout <<
"We out!\n";
229 if (
p_debug ) std::cout <<
"\nDistorting at " << ux <<
", " << uy <<
"\n";
238 if (
p_odk.size() < 2) {
250 double r = qSqrt(((x-x0) * (x-x0)) + ((y - y0) * (y-y0)));
269 std::cout <<
"Detector sample=" << m_focalMap->DetectorSample()
270 <<
", line=" << m_focalMap->DetectorLine()<<
"\n";
Distort/undistort focal plane coordinates.
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.
Convert between distorted focal plane and detector coordinates.
double DetectorSample() const
double DetectorLine() const
double DetectorSampleOrigin() const
double DetectorLineOrigin() const
double PixelPitch() const
Returns the pixel pitch.
CameraFocalPlaneMap * FocalPlaneMap()
Returns a pointer to the CameraFocalPlaneMap object.
@ Programmer
This error is for when a programmer made an API call that was illegal.
double m_detectorOriginLine
The origin of the detector's line coordinate.
virtual bool SetFocalPlane(double dx, double dy)
Compute undistorted focal plane x/y.
virtual ~OsirisRexOcamsDistortionMap()
Default Destructor.
double p_tolerance
Convergence tolerance.
double m_distortionOriginLine
The distortion's origin line coordinate.
bool p_debug
Debug the model.
double m_distortionOriginSample
The distortion's origin sample coordinate.
virtual void SetDistortion(int naifIkCode)
Load distortion coefficients and center-of-distortion for OCAMS.
double m_pixelPitch
The pixel pitch for OCAMS.
virtual bool SetUndistortedFocalPlane(double ux, double uy)
Compute distorted focal plane x/y.
OsirisRexOcamsDistortionMap(Camera *parent, double zDirection=1.0)
OSIRIS REx Camera distortion map constructor.
double m_detectorOriginSample
The origin of the detector's sample coordinate.
QString getString(const QString &key, int index=0)
This returns a value from the NAIF text pool.
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
This is free and unencumbered software released into the public domain.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
bool toBool(const QString &string)
Global function to convert from a string to a boolean.