Commit 80689e6b authored by Jeannie Backer's avatar Jeannie Backer
Browse files

PROG: Updated documentation. References #1461.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@8111 41f8697f-d340-4b68-9986-7bafba869bb8
parent 01678f03
Loading
Loading
Loading
Loading
+82 −11
Original line number Diff line number Diff line
@@ -24,12 +24,13 @@
#include "CameraDistortionMap.h"

namespace Isis {
  /** Camera distortion map constructor
  /** 
   * Camera distortion map constructor
   *
   * Create a camera distortion map.  This class maps between distorted
   * and undistorted focal plane x/y's.  The default mapping is the
   * identity, that is, the focal plane x/y and undistorted focal plane
   * x/y will be identical.
   * Create a radial camera distortion map.  This class maps between 
   * distorted and undistorted focal plane x/y's.  The default mapping 
   * is the identity, that is, the focal plane x/y and undistorted 
   * focal plane x/y will be identical. 
   *
   * @param parent        the parent camera that will use this distortion map
   * @param zDirection    the direction of the focal plane Z-axis
@@ -43,7 +44,15 @@ namespace Isis {
  }


  /** Load distortion coefficients
  /**
   * Destructor for the ISIS3 default camera distortion map. 
   */
  CameraDistortionMap::~CameraDistortionMap() {
  }


  /** 
   * Load distortion coefficients
   *
   * This method loads the distortion coefficients from the instrument
   * kernel.  The coefficients in the NAIF instrument kernel are
@@ -70,7 +79,8 @@ namespace Isis {
  }


  /** Compute undistorted focal plane x/y
  /** 
   * Compute undistorted focal plane x/y
   *
   * Compute undistorted focal plane x/y given a distorted focal plane x/y.
   * This virtual method can be used to apply various techniques for removing
@@ -114,7 +124,8 @@ namespace Isis {
  }


  /** Compute distorted focal plane x/y
  /** 
   * Compute distorted focal plane x/y
   *
   * Compute distorted focal plane x/y given an undistorted focal plane x/y.
   * This virtual method is used to apply various techniques for adding
@@ -192,7 +203,9 @@ namespace Isis {


  /** 
   * @returns The optical distortion of polynomial coefficients
   * Retrieve the distortion coefficients used for this model. 
   *  
   * @returns The optical distortion of polynomial coefficients.
   */
  std::vector<double> CameraDistortionMap::OpticalDistortionCoefficients() const {
    return p_odk;
@@ -200,11 +213,69 @@ namespace Isis {


  /** 
   * Gets the z-direction for this camera. The direction is represented as 
   * +/- 1. 
   * @returns The direction of the focal plane Z-axis
   */
  double CameraDistortionMap::ZDirection() const {
    return p_zDirection;
  }


  /** 
   * Gets the x-value in the focal plane coordinate system. This is represented 
   * in millimeters from the origin. 
   *  
   * @returns The distorted focal plane x.
   */
  double FocalPlaneX() const {
    return p_focalPlaneX;
  }
  

  /**
   * Gets the y-value in the focal plane coordinate system. This is represented 
   * in millimeters from the origin.
   *  
   * @returns The distorted focal plane y.
   */
  double FocalPlaneY() const {
    return p_focalPlaneY;
  }
  

  /**
   * Gets the x-value in the undistorted focal plane coordinate system. This is represented 
   * in millimeters from the origin.
   * 
   *@returns The undistorted focal plane x
   */
  double UndistortedFocalPlaneX() const {
    return p_undistortedFocalPlaneX;
  }
  

  /**
   * Gets the y-value in the undistorted focal plane coordinate system. This is represented 
   * in millimeters from the origin. 
   *  
   * @returns The undistorted focal plane y
   */
  double UndistortedFocalPlaneY() const {
    return p_undistortedFocalPlaneY;
  }
  

  /**
   * Gets the z-value in the undistorted focal plane coordinate system. This is 
   * represented as the focal length, in millimeters, with the sign indicating 
   * z-direction. 
   *  
   * @returns The undistorted focal plane z
   */
  double UndistortedFocalPlaneZ() const {
    return p_zDirection * p_camera->FocalLength();
  }

}
+10 −38
Original line number Diff line number Diff line
@@ -50,16 +50,18 @@ namespace Isis {
   *                           since no unitTest exists. Fixed indentation
   *                           of history entries.  References #1490.
   *   @history 2017-08-30 Summer Stapleton - Updated documentation. References #4807.
   *   @history 2017-09-04 Kristin Berry - Made SetDistortion virtual so that
   *                           individual camera model distortion maps can
   *                           set the values.
   *
   */
  class CameraDistortionMap {
    public:
      CameraDistortionMap(Camera *parent, double zDirection = 1.0);

      void SetDistortion(int naifIkCode);
      virtual void SetDistortion(int naifIkCode);

      //! Destructor
      virtual ~CameraDistortionMap() {}
      virtual ~CameraDistortionMap();

      virtual bool SetFocalPlane(double dx, double dy);

@@ -68,41 +70,11 @@ namespace Isis {
      std::vector<double> OpticalDistortionCoefficients() const;

      double ZDirection() const;

      /**
       * @returns The distorted focal plane x
       */
      inline double FocalPlaneX() const {
        return p_focalPlaneX;
      }

      /**
       * @returns The distorted focal plane y
       */
      inline double FocalPlaneY() const {
        return p_focalPlaneY;
      }

      /**
       *@returns The undistorted focal plane x
       */
      inline double UndistortedFocalPlaneX() const {
        return p_undistortedFocalPlaneX;
      }

      /**
       * @returns The undistorted focal plane y
       */
      inline double UndistortedFocalPlaneY() const {
        return p_undistortedFocalPlaneY;
      }

      /**
       * @returns The undistorted focal plane z
       */
      inline double UndistortedFocalPlaneZ() const {
        return p_zDirection * p_camera->FocalLength();
      }
      double FocalPlaneX() const;
      double FocalPlaneY() const;
      double UndistortedFocalPlaneX() const;
      double UndistortedFocalPlaneY() const;
      double UndistortedFocalPlaneZ() const;

    protected:
      Camera *p_camera;                 //!< The camera to distort/undistort
+1 −1
Original line number Diff line number Diff line
Unit Test for JunoCamera...
FileName:  "JNCE_2013282_00M00099_V01_BLUE_0004.cub"
FileName:  "JNCE_2013282_00M00099_V01_METHANE_0003.cub"
CK Frame:  -61500

Kernel IDs: 
+13 −12
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@
using namespace std;
using namespace Isis;

void TestLineSamp(Camera *cam, double samp, double line);
void TestSampLine(Camera *cam, double samp, double line);

/**
 * Unit test for Juno's JunoCam instrument.
@@ -43,6 +43,7 @@ void TestLineSamp(Camera *cam, double samp, double line);
 * @author 2017-09-11 Jesse Mapel
 * @internal
 *   @history 2017-09-11 Jesse Mapel - Original version.
 *   @history 2017-09-11 Jeannie Backer - Updated test data.
 */
int main(void) {
  Preference::Preferences(true);
@@ -52,10 +53,10 @@ int main(void) {
    // These should be lat/lon at center of image. To obtain these numbers for a new cube/camera,
    // set both the known lat and known lon to zero and copy the unit test output
    // "Latitude off by: " and "Longitude off by: " values directly into these variables.
    double knownLat = -60.9701087981032046;
    double knownLon = 268.988342485061139;
    double knownLat = -45.4762320380959295;
    double knownLon = 278.270465938390657;

    Cube c("$juno/testData/JNCE_2013282_00M00099_V01_BLUE_0004.cub", "r");
    Cube c("$juno/testData/JNCE_2013282_00M00099_V01_METHANE_0003.cub", "r");
    JunoCamera *cam = (JunoCamera *) CameraFactory::Create(c);
    qDebug() << "FileName: " << FileName(c.fileName()).name();
    qDebug() << "CK Frame: " << cam->instrumentRotation()->Frame();
@@ -83,19 +84,19 @@ int main(void) {

    // Test all four corners to make sure the conversions are right
    qDebug() << "For upper left corner ...";
    TestLineSamp(cam, 1250, 1.0);
    TestSampLine(cam, 952.0, 1.0);

    qDebug() << "For upper right corner ...";
    TestLineSamp(cam, cam->Samples(), 1.0);
    TestSampLine(cam, 1630.0, 1.0);

    qDebug() << "For lower left corner ...";
    TestLineSamp(cam, 1250, cam->Lines());
    TestSampLine(cam, 1005.0, cam->Lines());

    qDebug() << "For lower right corner ...";
    TestLineSamp(cam, cam->Samples(), cam->Lines());
    TestSampLine(cam, 1630.0, cam->Lines());

    double samp = 1435;
    double line = 75;
    double samp = 1300;
    double line = 64;
    qDebug() << "For center pixel position ...";

    if(!cam->SetImage(samp, line)) {
@@ -124,7 +125,7 @@ int main(void) {
  }
}

void TestLineSamp(Camera *cam, double samp, double line) {
void TestSampLine(Camera *cam, double samp, double line) {
  bool success = cam->SetImage(samp, line);

  if(success) {
@@ -135,7 +136,7 @@ void TestLineSamp(Camera *cam, double samp, double line) {
    double deltaSamp = samp - cam->Sample();
    double deltaLine = line - cam->Line();
    if(fabs(deltaSamp) < 1.0e-3) deltaSamp = 0.0;
    if(fabs(deltaLine) < 1.0e-4) deltaLine = 0.0;
    if(fabs(deltaLine) < 1.0e-3) deltaLine = 0.0;
    qDebug() << "DeltaSample = " << deltaSamp;
    qDebug() << "DeltaLine = " << deltaLine;
    qDebug() << "";