Commit c704198a authored by Kristin Berry's avatar Kristin Berry
Browse files

PROG: Updated OsrisRexDistortionMap to fix test failure. References #5126

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@8146 41f8697f-d340-4b68-9986-7bafba869bb8
parent c5abd573
Loading
Loading
Loading
Loading
+6 −11
Original line number Diff line number Diff line
@@ -84,7 +84,6 @@ namespace Isis {
   * @param naifIkCode    Code to search for in instrument kernel
   */
  void OsirisRexDistortionMap::SetDistortion(int naifIkCode, QString filter="UNKNOWN") {

    // Load distortion coefficients, including filter if we have it.
    QString odkkey;

@@ -92,7 +91,7 @@ namespace Isis {
      odkkey = "INS" + toString(naifIkCode) + "_OD_K";
    }
    else {
      odkkey = "INS" + toString(naifIkCode) + "_OD_K_" + filter.toUpper();
      odkkey = "INS" + toString(naifIkCode) + "_OD_K_" + filter.trimmed().toUpper();
    }

    try {
@@ -114,9 +113,8 @@ namespace Isis {
      odcenterkey = "INS" + toString(naifIkCode) + "_OD_CENTER";
    }
    else {
      odcenterkey = "INS" + toString(naifIkCode) + "_OD_CENTER_" + filter.toUpper(); 
      odcenterkey = "INS" + toString(naifIkCode) + "_OD_CENTER_" + filter.trimmed().toUpper(); 
    }

    m_distortionOriginSample = p_camera->Spice::getDouble(odcenterkey, 0);
    m_distortionOriginLine =   p_camera->Spice::getDouble(odcenterkey, 1);
  }
@@ -135,15 +133,14 @@ namespace Isis {
   * @return if the conversion was successful
   */
  bool OsirisRexDistortionMap::SetFocalPlane(double dx, double dy) {

    p_focalPlaneX = dx; 
    p_focalPlaneY = dy;

    // Only apply the distortion if we have the correct number of coefficients
    if ((p_odk.size() < 2)) {
    if (p_odk.size() < 2) {
      p_undistortedFocalPlaneX = dx;
      p_undistortedFocalPlaneY = dy;
      return false; 
      return true; 
    }

    double x0 = (m_distortionOriginLine - m_detectorOriginSample) * m_pixelPitch; 
@@ -223,17 +220,15 @@ namespace Isis {
   */
  bool OsirisRexDistortionMap::SetUndistortedFocalPlane(const double ux,
      const double uy) {

    p_undistortedFocalPlaneX = ux;
    p_undistortedFocalPlaneY = uy;

    // Only apply the distortion if we have the correct number of coefficients.
    if ((p_odk.size() < 2)) {
    if (p_odk.size() < 2) {
      p_focalPlaneX = ux;
      p_focalPlaneY = uy;
      return false; 
      return true; 
    }

    double x0 = (m_distortionOriginLine - m_detectorOriginSample) * m_pixelPitch;
    double y0 = (m_distortionOriginSample - m_detectorOriginLine) * m_pixelPitch;

+0 −2
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@
#include <QString>

#include "CameraDetectorMap.h"
//#include "CameraDistortionMap.h"
#include "OsirisRexDistortionMap.h"
#include "CameraFocalPlaneMap.h"
#include "CameraGroundMap.h"
@@ -113,7 +112,6 @@ namespace Isis {
        Spice::getDouble("INS" + ikCode + "_CCD_CENTER", 1) + 1.0);

    // Setup distortion map
//    new CameraDistortionMap(this);
    OsirisRexDistortionMap *distortionMap = new OsirisRexDistortionMap(this); 

    // Different distortion model for each instrument and filter
+6 −3
Original line number Diff line number Diff line
@@ -45,7 +45,10 @@ void testLineSamp(Camera *cam, double sample, double line);
 *                           for SamCam test (when we have an image we can spiceinit).
 *   @history 2017-08-29 Jeannie Backer - Added test for PolyCam and MapCam with
 *                           PolyCamFocusPositionNaifId keyword.
 *   
 *   @history 2017-09-18 Kristin Berry - Updated known latitudes and longitudes for the addition of
 *                           the distortion model. (For non-backwards compatibility MapCam cube
 *                           only, since we do not yet have a PolyCam cube with a motor position 
 *                           that we have a distortion solution for.) 
 * 
 */

@@ -80,8 +83,8 @@ int main(void) {
    testCamera(mapCamCube, sample, line, knownLat, knownLon);
    cout << "\nTesting MapCam (with PolyCamFocusPositionNaifId keyword)..." << endl;
    Cube mapCamCube2("$osirisrex/testData/20190303T100344S990_map_iofL2pan_V001.cub", "r");
    knownLat = -19.2944483457740930;
    knownLon = 145.9504680080907804;
    knownLat = -19.2946930665326732;
    knownLon = 145.9510736765638512;
    sample = 512.0; 
    line = 512.0;
    testCamera(mapCamCube2, sample, line, knownLat, knownLon);