11#include "Chandrayaan1M3DistortionMap.h" 
   12#include "CameraFocalPlaneMap.h" 
   17  Chandrayaan1M3DistortionMap::Chandrayaan1M3DistortionMap(
Camera *parent,
 
   19                                                           double k1, 
double k2, 
double k3,
 
   20                                                           double p1, 
double p2) :
 
   54    double rr = x * x + y * y;
 
   58    double dr = p_k1 + p_k2 * rr + 
p_k3 * rr * rr;
 
   62    double dtx = p_p1 * (rr + 2.0 * x * x) + 2.0 * 
p_p2 * x * y;
 
   63    double dty = 2.0 * p_p1 * x * y + 
p_p2 * (rr + 2 * y * y);
 
 
   91    double xx, yy, rr, dr;
 
   92    double xdistortion, ydistortion;
 
   93    double xdistorted, ydistorted;
 
   94    double xprevious, yprevious;
 
   99    xprevious = 1000000.0;
 
  100    yprevious = 1000000.0;
 
  102    double tolerance = 0.000001;
 
  104    bool bConverged = 
false;
 
  109    for (
int i = 0; i < 50; i++) {
 
  118      dr = p_k1 + p_k2 * rr + 
p_k3 * rr * rr;
 
  120      double dtx = p_p1 * (rr + 2.0 * xt * xt) + 2.0 * 
p_p2 * xt * yt;
 
  121      double dty = 2.0 * p_p1 * xt * yt + 
p_p2 * (rr + 2 * yt * yt);
 
  124      xdistortion = dr * xt + dtx;
 
  125      ydistortion = dr * yt + dty;
 
  128      xt = ux - xdistortion;
 
  129      yt = uy - ydistortion;
 
  132      xdistorted = xt + p_xp;
 
  133      ydistorted = yt + 
p_yp;
 
  136      if ((fabs(xt - xprevious) <= tolerance) && (fabs(yt - yprevious) <= tolerance)) {
 
 
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.
 
double p_focalPlaneY
Distorted focal plane y.
 
double p_p2
coefficients of decentering distortion
 
bool SetFocalPlane(const double dx, const double dy)
Compute undistorted focal plane x/y.
 
bool SetUndistortedFocalPlane(const double ux, const double uy)
Compute distorted focal plane x/y.
 
double p_yp
principal point coordinates
 
double p_k3
coefficients of radial distortion
 
This is free and unencumbered software released into the public domain.
 
Namespace for the standard library.