Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Isis 3 Programmer Reference
Hyb2OncDistortionMap.cpp
1
6
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include <QDebug>
10#include <QtGlobal>
11#include <QtMath>
12
13#include "Hyb2OncDistortionMap.h"
14
15namespace Isis {
31 : CameraDistortionMap(parent, zDirection) {
32 }
33
34
40
41
59 bool Hyb2OncDistortionMap::SetFocalPlane(double dx, double dy) {
60 p_focalPlaneX = dx;
61 p_focalPlaneY = dy;
62
63 // reducing to principal point offset (xp,yp)
64 double x = dx;// - p_xp;
65 double y = dy;// - p_yp;
66 //
67 // Get the distance from the focal plane center
68 double r = (x * x) + (y * y);
69 double r2 = r*r;
70 double r4 = r2*r2;
71
72 // apply distortion correction
73 // r = x^2 + y^2
74 // rprime = L0*r + L1*r^3 + L2*r^5, where Li are distortion coeffs
75 // "dr" is rprime divided by r, used to reduce operations
76 double dr = p_odk[0] + p_odk[1] * r2 + p_odk[2] * r4;
79 return true;
80 }
81
82
103 const double uy) {
106
107 // Compute the distance from the focal plane center
108
109 bool converged = false;
110 int iteration = 0;
111 double tolMilliMeters = p_camera->PixelPitch() / 100.0;
112 double x = ux;
113 double y = uy;
114 double r = (x * x) + (y * y);
115 double rPrevious = r;
116
117 while (!converged && qAbs(r - rPrevious) > tolMilliMeters) {
118 double r2 = r*r;
119 double r4 = r2*r2;
120 double dr = p_odk[0] + p_odk[1] * r2 + p_odk[2] * r4;
121 rPrevious = r;
122 x = dr * x;
123 y = dr * y;
124 r = x*x + y*y;
125
126 iteration++;
127 if (iteration > 50) {
128 converged = false;
129 break;
130 }
131 }
132
133 converged = true;
134 p_focalPlaneX = x;
135 p_focalPlaneY = y;
136
137 return converged;
138 }
139
140}
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 bool SetFocalPlane(double dx, double dy)
Compute undistorted focal plane x/y.
Hyb2OncDistortionMap(Camera *parent, double zDirection=1.0)
Hayabusa 2 ONC Camera distortion map constructor.
virtual ~Hyb2OncDistortionMap()
Destructor.
virtual bool SetUndistortedFocalPlane(double ux, double uy)
Compute distorted focal plane x/y.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16