Isis 3 Programmer Reference
MocWideAngleDistortionMap.cpp
Go to the documentation of this file.
1 
21 
22 using namespace std;
23 namespace Isis {
40  MocWideAngleDistortionMap::MocWideAngleDistortionMap(Camera *parent, bool red) :
41  CameraDistortionMap(parent, 1.0) {
42  // Set up distortion coefficients
43  if(red) {
44  p_coefs.push_back(0.9993258);
45  p_coefs.push_back(0.4655529);
46  p_coefs.push_back(-0.1548756);
47  p_coefs.push_back(1.827967);
48  p_coefs.push_back(-3.057435);
49  p_coefs.push_back(2.226331);
50  p_scale = 1.0;
51  p_icoefs.push_back(0.9995458);
52  p_icoefs.push_back(-0.4237090);
53  p_icoefs.push_back(0.2810857);
54  p_icoefs.push_back(-0.1697522);
55  p_icoefs.push_back(0.068131536);
56  p_icoefs.push_back(-0.012665644);
57  }
58  else {
59  p_coefs.push_back(1.000246);
60  p_coefs.push_back(0.4612695);
61  p_coefs.push_back(0.2352545);
62  p_coefs.push_back(0.3535922);
63  p_coefs.push_back(-0.2853861);
64  p_coefs.push_back(0.5574971);
65  p_scale = 1.000452;
66  p_icoefs.push_back(0.9994557);
67  p_icoefs.push_back(-0.4515307);
68  p_icoefs.push_back(0.3152195);
69  p_icoefs.push_back(-0.1993053);
70  p_icoefs.push_back(0.081707217);
71  p_icoefs.push_back(-0.014814299);
72  }
73  p_numCoefs = 6;
74  }
75 
76 
78  const double dy) {
79  // Apply scale factor
80  p_focalPlaneX = dx;
81  p_focalPlaneY = dy;
82  double sdy = dy / p_scale;
83 
84  // See if we are close to the boresight which implies no distortion
85  double s2 = dx * dx + sdy * sdy;
86  if(s2 <= 1.0E-6) {
89  return true;
90  }
91 
92  // Remove distortion
93  double s = sqrt(s2);
94  double ang = atan(s / p_camera->FocalLength());
95  double ang2 = ang * ang;
96  double angp = p_coefs[p_numCoefs-1];
97  for(int i = p_numCoefs - 2; i >= 0; i--) {
98  angp = angp * ang2 + p_coefs[i];
99  }
100  angp = angp * ang;
101  double sp = p_camera->FocalLength() * tan(angp);
102  p_undistortedFocalPlaneX = dx * sp / s;
103  p_undistortedFocalPlaneY = sdy * sp / s;
104  return true;
105  }
106 
108  const double uy) {
111 
112  // See if we are close to boresight
113  double sp2 = ux * ux + uy * uy;
114  if(sp2 <= 1.0E-6) {
115  p_focalPlaneX = ux;
116  p_focalPlaneY = uy * p_scale;
117  return true;
118  }
119 
120  // Add distortion
121  double sp = sqrt(sp2);
122  double angp = atan(sp / p_camera->FocalLength());
123  double angp2 = angp * angp;
124  double ang = p_icoefs[p_numCoefs-1];
125  for(int i = p_numCoefs - 2; i >= 0; i--) {
126  ang = ang * angp2 + p_icoefs[i];
127  }
128  ang = ang * angp;
129  double s = p_camera->FocalLength() * tan(ang);
130  p_focalPlaneX = ux * s / sp;
131  p_focalPlaneY = uy * s / sp * p_scale;
132  return true;
133  }
134 }
double p_focalPlaneX
Distorted focal plane x.
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.
virtual bool SetUndistortedFocalPlane(const double ux, const double uy)
Compute distorted focal plane x/y.
double FocalLength() const
Returns the focal length.
Definition: Camera.cpp:2744
virtual bool SetFocalPlane(const double dx, const double dy)
Compute undistorted focal plane x/y.
Distort/undistort focal plane coordinates.
const double E
Sets some basic constants for use in ISIS programming.
Definition: Constants.h:55
double p_focalPlaneY
Distorted focal plane y.
double p_undistortedFocalPlaneY
Undistorted focal plane y.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31