ISIS Documentation

nocam2map

Map project a cube without a camera model

This program will map project a raw instrument cube without a camera model. However, the lack of a camera model requires latitude/longitude information at each pixel in the raw cube. This must be facilitated through a latitude cube and longitude cube with the same size as the raw instrument cube.

The procedure to project the input cube is output driven. That is, we create an output map cube (as specified by the user) and at each output pixel, compute its projected latitude/longitude using the projection parameters. Using this coordinate we must search for that position in the two input cubes (latitude/longitude). If found, we will have a sub-pixel location that has a 1-1 correspondence with the raw instrument pixel. An interpolator (nearest neighbor, bilinear, or cubic convolution) is then used to compute a value for the output pixel.

Therefore, the root of the problem is finding the latitude/longitude in the two input cubes as it is a 2-dimensional search. We do this by first creating two polynomial functions of a user-specified order (DEGREE), one for sample and one for line. These functions, f(lat,lon) = sample and g(lat,lon) = line, are derived using a least-squares computation by collecting a sparse set of control points (line,samp)-to-(lat,lon). The sparseness is controlled by the SINC and LINC. Unfortunately, the polynomial is not accurate enough to supply the mapping to sub-pixel accuracy. The level of errors between the control points and the derived equations can be written to the RESIDUAL file for examination.

To achieve sub-pixel accuracy, we use the polynomials to get us close (generally within 6 pixels). Using this estimated location, two affine transforms are computed by collecting a small 3x3 window of control points. These equations are used to further refine the estimated location. We iterate this process until our estimated sample/line is within an acceptable tolerance (TOLERANCE) of latitude/longitude values contained in the two cubes (LATCUBE/LONCUBE) or until the number of iterations is exceeded (ITERATIONS).

Defining the output map projection is controlled as follows:

  • ProjectionName - Should be specified by the map file
  • TargetName - Will be searched for in the FROM cube or can be specified by the user.
  • EquatorialRadius and PolarRadius- Will be automatically computed from NAIF kernels or can be specified by the user.
  • LatitudeType - Will be read from the map file if available, otherwise will be set to the latitude type of the LATCUBE
  • LongitudeDirection - Will be read from the map file if available, otherwise will be set to the longitude direction of the LONCUBE
  • LongitudeDomain - The longitude domain will be 0-360 by default.
  • MinimumLatitude - Can be computed from the LATCUBE, read from the map file or user specified.
  • MaximumLatitude - Can be computed from the LATCUBE, read from the map file or user specified.
  • MinimumLongitude - Can be computed from the LONCUBE, read from the map file or user specified.
  • MaximumLongitude - Can be computed from the LONCUBE, read from the map file or user specified.
  • Scale or PixelResolution - Can be computed1 from the input, read from the map file, or user specified in either meters/pixel (PixelResolution) or pixels/degree (Scale)

        1To compute the scale we find the number of pixels from pixel (1, 1)
        to pixel (nsamples, nlines) in the input cube:
        sqrt[(nsamples-1)2 + (nlines-1)2]
        And the angle across this line:
        acos(cos(latitude_point1) * cos(latitude_point2) * cos(longitude_point1 - longitude_point2) + sin(latitude_point1) * sin(latitude_point2))
        The scale is equal to the number of pixels divided by the angle in pixels per degree.
      

If the program is run on an image with a camera model contained in the label, much of the model information is deleted in the output cube. This avoids display conflicts between the built in display solution of the camera model and that generated by the projection function.

This application fails to produce correct output with smaller cubes sized 5x1, 1x5 or smaller. The error message provided is: "**ERROR** Unable to solve-least squares using QR Decomposition. The upper triangular R matrix is not full rank in LeastSquares.cpp at 402." This issue occurs because there is not enough information provided by small cubes for the equations used.


Categories


History

Noah Hilt2008-08-01 Original Version
Christopher Austin2009-01-27 Fixed parameter names
Noah Hilt2009-03-02 The min/max longitude/latitude are now converted from the input domain to the map file's domain if necessary.
Travis Addair2009-08-10 Mapping group parameters are now placed into the print file.
Annie Howington and Tracie Sucharski2012-01-13 Updated documentation.
Tracie Sucharski2012-12-06 Changed to use TProjection instead of Projection. References #775
Sasha Browsnberger2015-02-12 If it exists, certain camera model information is removed from the label in the output image.
Kristin Berry2015-07-22 Added NaifStatus::CheckErrors() to see if any NAIF errors were signaled. References #2248
Jeannie Backer2016-05-10 Replaced calls to NAIF routines (bodn2c and bodvar) with call to static method Isis::Target::radiiGroup. References #3934
Curtis Rose2016-05-16 Fixed an issue with small cubes (9x9 or less) causing application to become stuck in an infinite loop. References #2284. Also added to the description a message about why the application fails on small cubes (5x1, 1x5, or less).