Resample

ERDAS IMAGINE Help

HGD_Variant
16.5.1
HGD_Product
ERDAS IMAGINE
HGD_Portfolio_Suite
Producer

Select a resampling method and set the pixel cell size to use for the output image when rectifying or orthorectifying an image.

Before the image can be resampled, reference data must be calculated, and models (except for Affine and Reproject) must have a solution, or the image must be calibrated.

The quick reprojection may not work with some whole-earth images or images at extreme northern or southern latitudes, and you should use the rigorous Reproject Images dialog to correctly reproject these images.

Refer to the Reprojection Grid discussion under Transformation Matrix for more information.

The following are discussed in this topic:

  • Dialog Description
  • Correcting DEM Problems
  • Selecting the Correct Resampling Method
  • Resampling by Large Ratios

Dialog Description

This dialog opens when you:

  • Click the Resample icon resample.png in Multipoint Geometric Correction workspace.
  • Click Apply in a Model Properties dialog during a rectification or orthorectification process.

Resample to output file?    Click to enable the Output File field in order to resample the input file and save it with another file name.

If you want to attach a sensor model to an image without performing resampling, click to uncheck this checkbox. Then you can select Update Calibration option and write the geometric model information and elevation information to the *.aux file or image metadata as appropriate without producing a resampled image.

Output File    Select the file format type for the resampled image and navigate to a directory to store the image, or click the dropdown arrow to open the Recent Files menu.

open.png    Click to open File Selector to choose the format type for the image, and navigate to the directory to store the image.

Files of type    In the File Selector, click the dropdown arrow to select the output file format.

Resample Method    Click the dropdown arrow to select the desired interpolation method for resampling.

Nearest Neighbor   Assigns the value of the closest pixel.

Bilinear Interpolation    Uses the data file values of four pixels in a 2 x 2 window to calculate an output value with a bilinear function.

Cubic Convolution    Uses the data file values of 16 pixels in a 4 x 4 window to calculate an output value with a cubic function.

Bicubic Spline    Uses a block size of 5 x 5 or larger. This method fits a cubic spline surface through the current block of points. The output value is derived from the fitting surface that retains the values of the known points. This option may be available depending on which type of data is currently displayed or used in a process.

exclamation_point_icon The Bicubic Spline algorithm is much slower than other methods of interpolation.

LaGrange Uses the values of 16 pixels in a 4 x 4 window to calculate an output value with a cubic function that uses the LaGrange coefficients.

reference_iconSee Resampling Methods section in Producer Field Guide for more information.

Do not use the bicubic spline resampling method with radar (SAR) data.

Calibration    These options report the current geometric model if assigned, and allow you to select an elevation source if orthorectifying.

Current Geo Model:    Reports the name of the geometric model currently used in the image.

Elevation Source    Specify an elevation source to be used in the geocorrection.

File    Click if elevation information is coming from a separate file, such as a DTM or DEM. You select the file in the DTM File field below.

DTM File    This field works in conjunction with the File option. The Global Elevation Source proxy file, stored in the Elevation Library, is shown by default. You can accept the default, or click the dropdown arrow to open the Recent Files menu.

open.png    Click to open File Selector to navigate to the elevation source file.

Constant    Click to enter a constant value for the image. A constant value is an average ground elevation value for the entire scene. You enter that value in the elevation Value field.

[Elevation] Value    This field works in conjunction with the Constant option. Enter the average elevation value to be used.

[Elevation Units]    This field works in conjunction with the Constant option, and displays units in which the elevation is measured. The default value shown here is derived from the metadata or RPC file.

Elevation Library    Click to use the data in the Elevation Library as the source.

Update Calibration    Check this checkbox to write the geometric model information and elevation information to the *.aux file or image metadata as appropriate.

Output Map Information    The output map information options are automatically preset with intelligent defaults based on the input image geometry and the geometric model.

Projection    Reports the default output map projection type. This is the projection of the reference map system of the geometric model.

Units    Displays the default output map units. This is the units of the reference map system of the geometric model.

Number rows    Displays the number of rows in the output file.

Number columns    Displays the number of columns in the output file.

These are both computed based on the Output Corners and Output Cell Sizes variables below.

Snap pixel edges to    Click to turn on this option to snap the pixel edges of the output image to align to a raster image or to a point. Both options use pixel edge alignment.

raster image    To line up the edges of images such that there are no gaps or overlaps when the images are cropped, click this to snap pixel edges to a raster image that you specify.

File to snap to (*.img)    Enter the name of the raster image, or click the dropdown arrow to open the Recent Files menu.

open.png    Click the Open File icon to open the File Selector dialog, or right-click to open the Recent Files menu.

a point    To line up pixel edges along grid lines, click this to snap pixel edges to a point that you specify. For example, if your output file has 10 meter pixel cell size (ground resolution), you can set the snap point to 0,0 to align all the pixels to every 10 meters in the map projection.

When you want to use pixel cell sizes (ground resolution) expressed in integers, rather than real numbers, use Snap to a point option. Enter the x,y coordinate of the output image that will be the origin of the grid to align the pixels to the grid. Then after processing, the pixels edges will line up along the grid where one whole pixel will equal the respective value of the grid.

X:    Enter the X coordinate of the point to snap to.

Y:    Enter the Y coordinate of the point to snap to.

When the map projection of the input file and the output file have different map orientations, or the input image is calibrated, the output file may contain unexpected results when applying Snap pixel edges option.

Output Corners    Specify the corners of the output image.

ULX    Enter the upper-left X coordinate for the resampled image.

LRX    Enter the lower-right X coordinate for the resampled image.

ULY    Enter the upper-left Y coordinate for the resampled image.

LRY    Enter the lower-right Y coordinate for the resampled image.

The default output corners are computed from the input image and geometric model to resample the entire input image. This is done by transforming the four corners of the input image with the geometric model forward transformation. Note that these corners may not represent the entire input image space when using a nonaffine or nonfirst-order polynomial. The option to Recalculate Output Defaults samples a grid of points (rather than just the four corners) to more closely match the entire input image space.

From Inquire Box    Click to define a subset area of the data by using the Inquire Box. When you click this button, the coordinates below are updated with the coordinates of the Inquire Box in the View.

To change these coordinates, you can move and/or resize the Inquire Box in the View, then click this button again.

The image you are using and the Inquire Box must already be displayed in a View in order to use the From Inquire Box option. Otherwise, you may manually enter coordinates in the fields above.

Output Cell Sizes    Specify the pixel cell size (ground resolution) of the output image. The size is measured in X and Y.

X   Enter the cell size in the X direction, expressed in angular units of decimal degrees. The default output X cell size is reported.

Y    Enter the cell size in the Y direction, expressed in angular units of decimal degrees. The default output Y cell size is reported.

X    Nominal output cell size in the X direction, expressed in feet or meters according to Feet/Meters Units option.

Y    Nominal output cell size in the Y direction, expressed in feet or meters according to Feet/Meters Units option.

Feet/Meters Units   Click to express the nominal cell size either in meters or in feet. The Nominal Cell Sizes dialog opens.

Force Square Pixels on Reprojection    If you want square pixel size where X equals Y, check this option before projecting the image to another projected coordinate system. The default pixel size is rectangular where X and Y are not equal.

favorite    After you have determined your choice for Force Square Pixels on Reprojection, you can click this Set Preference icon to set the current setting as the default.

Output Cell Size Computation

The output cell sizes have automatically computed default vaules. These are based on an assumption that optimum cell size neither oversamples or undersamples the input image space. For example, the output image extent is approximately the same as the input image. These are only provided as defaults and may not be the desired values in all applications.

The default cell size is based on these rules:

  • The sum of 2 diagonal lengths of 4 corner points in map space divided by the sum in pixel space.
  • The nearest integer value is used if the value above is larger than 1.0.
  • Same for both x and y dimension.

Recalculate Output Defaults    Click to reset the output defaults. The Recalculate Output Defaults dialog opens. This may be necessary when using a non-affine or non-first-order polynomial. These geometric models may not be able to define the proper output extent using only the four corners of the input image. A grid sampling approach provides a better estimation of the geometrically transformed input image extent.

Ignore Zero in Stats    Click this checkbox to ignore zero when computing the statistics for the output file.

OK    Click to accept your edits and start resampling.

Batch Open Batch Command Editor to schedule one or multiple processing jobs.

Cancel    Click to cancel your edits and close the dialog.

Help    Click to open this Help document.

Using Batch for Multiple Processing Jobs

When multiple input images are calibrated or have geometric models embedded, Batch could be used to schedule multiple processing jobs. Here is one use case with step-by-step instructions:

  1. On the Batch Command Editor, change Variables to "One input, one or more outputs". In the Variable Values cell array, there will be four variables: Input1, Output1, Output2 and Output3, representing the input image, output image, binary model file and DEM file respectively. The last one will not be applicable if DEM data is not used in the resampling process.
  2. Delete the contents from "-xform" to "-deleteflag" on the Commands section to remove the binary model file from consideration since the calibration information will be used for resampling instead. By default, the map extents and units will be automatically configured based on the calibration information. The pixel size is maintained if the units from the calibration and the command option "-u" are compatible (both linear or angular). If all the output images are going to use the same map extents, pixel size and units, delete the "-resetmap" option from the command line.
  3. Click Edit button to bring up the Variable Editor dialog. Delete the Output2 which is for the binary model file. Input1, Output1 and Output3 remain.
  4. Highlight Output1 and set up its pattern such as c:/output_folder/ortho_$(Input1.root).img which is based on the input file name.
  5. Highlight Output3. Make sure the check box "Delete File Before Processing" is un-checked. If no pattern exists between the input image and associated DEM names, change the Type from Auto to User.
  6. Enable the check box "Show Full Pathname" for better view of file names. Enable the check box "Use Filechooser to Edit Names" so that you could edit the input image and DEM names if needed.
  7. Close Variable Editor and start adding more input files. Click Preview to preview all the command line contents.
  8. Now you are ready to run with multiple files.

Correcting DEM Problems

This information may help with the orthorectification of images.

There are two cases in which the way statistics are calculated for a DEM can cause bad results in orthorectification. One case is when background values are included in statistics calculation when they should be ignored. The other case is when valid zero values are not included in statistics calculation when they should be.

Another potential problem area with DEMs used in orthorectification is the selected resampling method.

Background values included in statistics calculation

DEMs that contain background areas may give bad results when used in orthorectification if the background value is included in statistics calculation. This kind of file may look something like the following illustration.

bkgdarea

To correct this, go to Image Metadata > Compute Pyramid Layers/Statistics. Check the Ignore Value checkbox, enter the background value in the number field, and click OK to recalculate the statistics.

Zero values excluded from statistics calculation

DEMs that have valid zeros that were ignored in statistics calculation yield areas of NoData (dropouts) when used in orthorectification (see illustration below). This may occur if the Ignore Zeros preference is set in the Raster Import (General) category.

elevation_data_nodata_ignore_zero

To correct this, go to Image Metadata > Compute Pyramid Layers/Statistics. Ensure that the Ignore Value checkbox is not checked, and click OK to recalculate the statistics.

To learn how to edit raster pixel values to fill the NoData area, see Edit Raster Pixel Values to Correct DEM Errors workflow.

Guidelines for DEM Selection for Ortho Resampling

The DEM should be large enough that the entire area to be orthorectified is covered by the extent of the DEM (excluding background). This eliminates possible conflicts between zero background value and zero data value.

If the DEM is too small to completely cover the orthorectification area and has zero background values and zero data values, neither of the methods above is completely satisfactory. One way to approach the problem would be to locate and change zero data values to a very small number (0.001 for Float or Double type data, or 1 for 8-bit or16-bit data) and then recompute statistics ignoring zeros. This eliminates the effects of the background while having minimal effect on sea-level elevations.

Selecting the Correct Resampling Method

Use Bilinear Interpolation when the:

  • DEM cell size is much greater than the image cell size (for example, a 30-meter DEM with 1-meter air photo)
  • DEM covers the entire output area of the orthorectified image

Use Nearest Neighbor when the:

  • DEM covers less than the output area of the orthorectified image
  • DEM cell size is approximately the same as the image cell size (for example, a  30-meter DEM with 10-meter Spot)

Use Cubic Convolution when the:

  • DEM cell size is much greater than the image cell size (cubic convolution is very similar to bilinear interpolation)
  • DEM covers the entire output area of the orthorectified image

The differences in cubic convolution and bilinear interpolation are that a set of 16 pixels in a 4x4 array is averaged to determine the output data file value for cubic convolution whereas in bilinear interpolation, the data file value of the rectified pixel is based on the distances between the retransformed coordinate location and the four closest pixels in the input image. Cubic convolution also is an approximation of a cubic function, and bilinear interpolation is an approximation of a linear function.

Use Bicubic Spline Interpolation when the:

  • DEM cell size is much greater than the image cell size -at least 5x5
  • DEM covers the entire output area of the orthorectified image

Bicubic spline interpolation is also very similar to bilinear interpolation. The conditions for bicubic spline are almost the same as for bilinear. If you do not have the special need to make the surface much smoother, bilinear interpolation is recommended.

Resampling by Large Ratios

When you are resampling to a coarser or finer pixel size by a larger ratio such as 4:1, these guidelines are recommended to preserve as much pixel information as possible.

Up-Sampling to Finer Pixel Size

When you want to resample an image to a finer pixel size, for example, from 4 meter pixel size to 50 cm pixel size, the Bilinear Interpolation method is recommended. This method uses the data file values of four pixels in a 2 x 2 array to calculate an output value with a bilinear function. This method results in output images that are smoother and more spatially accurate than the Nearest Neighbor method. An example of a pixel with a data value of 3 is shown being split into multiple pixels in the up-sample process.

One Pixel Up-Sampled to Finer Pixel Size (Data Value = 3)

resample_large_ratios_down

Down-Sampling to Coarser Pixel Size

When you want to resample an image to a coarser pixel size, for example, from 50 cm pixel size to 4 meter pixel size, the Cubic Convolution method is recommended. This method uses the data file values of 16 pixels in a 4 x 4 window to calculate an output value with a cubic function. The effect of the cubic curve weighting can both sharpen the image and smooth out noise.

Be aware that you are losing data file value information during this process, therefore, consider breaking the resampling process into multiple processes, such as 50 cm to 2 meters, then 2 meters to 4 meters to take more of the data file values into account.

This method is much slower than Bilinear Interpolation.

2 x 2 Array vs 4 x 4 Array

resample_large_ratios_up

Resampling Ratios larger than 4:1

When you want to resample an image where the ratio is larger than 4:1, the Degrade method of Spatial Enhancement is recommended. However, note that the Degrade method is limited to an integer factor in the X and Y directions. Degrade averages all of the original "small" pixels that make up the new "big" pixels. If the X and Y factors are large, this method takes more of the original pixels into account in the computation than a bilinear interpolation or cubic convolution resample would, since these resampling methods use only a small window for computation.