12#include <boost/math/special_functions/legendre.hpp>
15#include "CameraFocalPlaneMap.h"
17#include "FunctionTools.h"
19#include "LineScanCameraDetectorMap.h"
20#include "NewHorizonsMvicTdiCameraDistortionMap.h"
25using namespace boost::math;
49 vector<double> xDistortionCoeffs,
50 vector<double> yDistortionCoeffs,
51 vector<double> residualColDistCoeffs,
52 vector<double> residualRowDistCoeffs) :
111 double deltax1 = 0.0;
118 double deltax2 = 0.0;
119 double deltay2 = 0.0;
164 double xprevious, yprevious;
166 double deltax2 = 0.0;
167 double deltay2 = 0.0;
169 xprevious = 1000000.0;
170 yprevious = 1000000.0;
172 double tolerance = 0.000001;
174 bool bConverged =
false;
179 for (
int i = 0; i < 50; i++ ) {
186 if (fabs(xtScaled) > 1.0) {
201 if ((fabs(xt - xprevious) <= tolerance) && (fabs(yt - yprevious) <= tolerance)) {
238 const double xscaled,
239 const double yscaled,
242 double lpx0, lpx1, lpx2, lpx3, lpx4, lpx5;
243 double lpy0, lpy1, lpy2, lpy3, lpy4, lpy5;
247 lpx0 = legendre_p(0,xscaled);
248 lpx1 = legendre_p(1,xscaled);
249 lpx2 = legendre_p(2,xscaled);
250 lpx3 = legendre_p(3,xscaled);
251 lpx4 = legendre_p(4,xscaled);
252 lpx5 = legendre_p(5,xscaled);
253 lpy0 = legendre_p(0,yscaled);
254 lpy1 = legendre_p(1,yscaled);
255 lpy2 = legendre_p(2,yscaled);
256 lpy3 = legendre_p(3,yscaled);
257 lpy4 = legendre_p(4,yscaled);
258 lpy5 = legendre_p(5,yscaled);
260 catch (
const std::exception& e) {
301 double &residualDeltax,
302 double &residualDeltay) {
304 double s = 2500.5 - dx/0.013;
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.
Camera * p_camera
The camera to distort/undistort.
double p_focalPlaneY
Distorted focal plane y.
double PixelPitch() const
Returns the pixel pitch.
int Samples() const
Returns the number of samples in the image.
NewHorizonsMvicTdiCameraDistortionMap(Camera *parent, vector< double > xDistortionCoeffs, vector< double > yDistortionCoeffs, vector< double > residualColDistCoeffs, vector< double > residualRowDistCoeffs)
Camera distortion map constructor.
void computeResidualDistortionCorrections(const double dx, double &residualDeltax, double &residualDeltay)
Compute residual distortion corrections in row and column direction TODO: Implementati plete.
double m_focalPlaneHalf_x
half of focal plane x and y dimensions in mm
virtual bool SetFocalPlane(const double dx, const double dy)
Compute undistorted focal plane x/y.
std::vector< double > m_yDistortionCoeffs
by Keith Harrison (Interface Control Document section 10.3.1.2)
virtual bool SetUndistortedFocalPlane(const double ux, const double uy)
Compute distorted focal plane x/y.
std::vector< double > m_xDistortionCoeffs
distortion coefficients in x and y as determined
vector< double > m_residualColDistCoeffs
residual distortion coefficients as determined
~NewHorizonsMvicTdiCameraDistortionMap()
Destructor.
bool computeDistortionCorrections(const double xscaled, const double yscaled, double &deltax)
Compute distortion corrections in x and y direction.
vector< double > m_residualRowDistCoeffs
by Jason Cook, SWRI (MVIC Distortion)
This is free and unencumbered software released into the public domain.
Namespace for the standard library.