Help for MARSRESCALE

PURPOSE:

MARSRESCALE program is used to rescale an image from the current grid
to an arbitrary grid.  Currently two interpolation methods are supported:
bilinear and bicubic spline.  Bicubic spline method is default.

The image can be either upsampled or downsampled.  Upsampling and 
downsampling rates are specified using either NL and NS parameters or 
ZOOM parameter.  If both NL,NS and ZOOM parameters are specified, ZOOM 
parameter value is ignored.

Marsrescale will handle multi-band images automatically if the BAND 
parameter is not specified. If BAND is specified, only that single band 
(in the multi-band images) is processed. If a non-existent band (e.g. 4th 
band for a 3-band image) is specified, the first band is processed.


EXECUTION:

marsrescale inp=in_image out=out_image NL=nl_new NS=ns_new -method

marsrescale inp=in_image out=out_image ZOOM=zoom -method

marsrescale inp=in_image out=out_image BAND = band ZOOM=zoom -method

Upsampling and downsampling rates are specified using either NL and NS 
parameters or ZOOM parameter.  If both NL,NS and ZOOM parameters are 
specified, ZOOM parameter value is ignored.

Examples:

Single-band image:

marsrescale NLB_532342096RAS_F0592578NCAM00278M1.IMG test_2048x2048_bilinear.vic NL = 2048 NS = 2048 -bilinear
marsrescale NLB_532342096RAS_F0592578NCAM00278M1.IMG test_zoom2_bilinear.vic ZOOM = 2 -bilinear
marsrescale NLB_532342096RAS_F0592578NCAM00278M1.IMG test_2048x2048_bicubic.vic NL = 2048 NS = 2048 -bicubic
marsrescale NLB_532342096RAS_F0592578NCAM00278M1.IMG test_zoom2_bicubic.vic ZOOM = 2 -bicubic
marsrescale NLB_532342096RAS_F0592578NCAM00278M1.IMG test_512x512_bicubic.vic NL = 512 NS = 512 -bicubic
marsrescale NLB_532342096RAS_F0592578NCAM00278M1.IMG test_zoom0.5_bicubic.vic ZOOM = 0.5 -bicubic

Multiple-band image:

Process all bands:

marsrescale MH0_445788563EDR_S0261274MHLI00350M1.IMG MH0_zoom2_bicubic.vic ZOOM = 2 -bicubic

Process band 2:

marsrescale MH0_445788563EDR_S0261274MHLI00350M1.IMG MH0_zoom2_bicubic_band2.vic BAND = 2 ZOOM = 2 -bicubic

If set to process a non-existing band (e.g. 4), the processing would be performed on band 1: 

marsrescale MH0_445788563EDR_S0261274MHLI00350M1.IMG MH0_zoom2_bicubic_band4.vic BAND = 4 ZOOM = 2 -bicubic


METHOD:

Marsrescale program loops over pixels in the specified/new grid and
identifies the corresponding pixels in original grid, which are used
for interpolation.  In order to consider pixels as areas instead of points,
we consider the transformation:

 ii = (i+0.5) * nl_old / nl_new - 0.5

This transformation maps -0.5 -> -0.5 and nl_new-0.5 -> nl_old-0.5
using 0-based indexing.


REFERENCES:

[1] Igor Yanovsky, Bilinear and Bicubic Interpolation, Report, 2017.
[2] Bicubic interpolation. (2016, November 28). In Wikipedia, The Free Encyclopedia, https://en.wikipedia.org/wiki/Bicubic_interpolation.
[3] Generalized Bicubic Interpolation, GIASSA.NET, https://www.giassa.net/?page_id=371.
[4] Xiao Shu, Bicubic Interpolation slides, http://www.ece.mcmaster.ca/~xwu/3sk3/interpolation.pdf, Mar. 2013.
[5] Don Lancaster, A Review of Some Image Pixel Interpolation Algorithms, https://www.tinaja.com/glib/pixintpl.pdf, Mar. 2013.


HISTORY:
  2017-09    Igor Yanovsky - Initial Version
  2017-11    Igor Yanovsky - Revised to allow color imagery to be processed with a single call
  2018-08    Francois Ayoub - Added Nearest Neighbor sampler
  2020-02-06 Walt Bunch - IDS-7928 - Corrected format string to match arg, added unit test
  2020-05-15 Walt Bunch - IDS-7927 - Replaced sprintf calls

COGNIZANT PROGRAMMER: Igor Yanovsky


PARAMETERS:


INP

Input image

OUT

Output rescaled image

BAND

The input file band number to use

NL

Number of lines in the rescaled image

NS

Number of samples in the rescaled image

ZOOM

Zoom factor for rescaled image

METHOD

Interpolation method to use

NAVTABLE

Corrected navigation filename

CONFIG_PATH

Path used to find configuration/ calibration files

POINT_METHOD

Specifies a mission-specific pointing method to use

NOSITE

Disables coordinate system sites.

See Examples:


Cognizant Programmer: