23 #include <boost/math/special_functions/legendre.hpp> 54 NewHorizonsMvicFrameCameraDistortionMap::NewHorizonsMvicFrameCameraDistortionMap(
Camera *parent,
55 vector<double> xDistortionCoeffs,
56 vector<double> yDistortionCoeffs) :
148 double yscaled = -dy/m_focalPlaneHalf_y;
154 double deltax, deltay;
225 double xScaledDistortion, yScaledDistortion;
229 double ytScaled = -uy/m_focalPlaneHalf_y;
231 double uxScaled = xtScaled;
232 double uyScaled = ytScaled;
234 double xScaledPrevious = 1000000.0;
235 double yScaledPrevious = 1000000.0;
237 double tolerance = 0.000001;
239 bool bConverged =
false;
244 for(
int i = 0; i < 50; i++ ) {
250 xtScaled = uxScaled - xScaledDistortion;
251 ytScaled = uyScaled - yScaledDistortion;
254 if((fabs(xtScaled - xScaledPrevious) <= tolerance) && (fabs(ytScaled - yScaledPrevious) <= tolerance)) {
259 xScaledPrevious = xtScaled;
260 yScaledPrevious = ytScaled;
266 ytScaled *= -m_focalPlaneHalf_y;
348 const double yscaled,
349 double &deltax,
double &deltay) {
351 double lpx0, lpx1, lpx2, lpx3, lpx4, lpx5;
352 double lpy0, lpy1, lpy2, lpy3, lpy4, lpy5;
358 lpx0 = legendre_p(0,xscaled);
359 lpx1 = legendre_p(1,xscaled);
360 lpx2 = legendre_p(2,xscaled);
361 lpx3 = legendre_p(3,xscaled);
362 lpx4 = legendre_p(4,xscaled);
363 lpx5 = legendre_p(5,xscaled);
364 lpy0 = legendre_p(0,yscaled);
365 lpy1 = legendre_p(1,yscaled);
366 lpy2 = legendre_p(2,yscaled);
367 lpy3 = legendre_p(3,yscaled);
368 lpy4 = legendre_p(4,yscaled);
369 lpy5 = legendre_p(5,yscaled);
372 catch (
const std::exception& e) {
double p_focalPlaneX
Distorted focal plane x.
std::vector< double > m_yDistortionCoeffs
by Keith Harrison (Interface Control Document section 10.3.1.2)
double m_focalPlaneHalf_x
half of focal plane x and y dimensions in mm
virtual bool SetUndistortedFocalPlane(const double ux, const double uy)
Compute distorted focal plane x/y.
Namespace for the standard library.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
double p_undistortedFocalPlaneX
Undistorted focal plane x.
Camera * p_camera
The camera to distort/undistort.
bool computeDistortionCorrections(const double xscaled, const double yscaled, double &deltax, double &deltay)
Compute distortion corrections in x and y direction.
virtual bool SetFocalPlane(const double dx, const double dy)
Testing method to output corrections in x and y at pixel centers for entire focal plane...
Distort/undistort focal plane coordinates.
double PixelPitch() const
Returns the pixel pitch.
~NewHorizonsMvicFrameCameraDistortionMap()
Destructor.
double p_focalPlaneY
Distorted focal plane y.
double p_undistortedFocalPlaneY
Undistorted focal plane y.
std::vector< double > m_xDistortionCoeffs
distortion coefficients in x and y as determined
int Lines() const
Returns the number of lines in the image.
int Samples() const
Returns the number of samples in the image.
Namespace for ISIS/Bullet specific routines.