SCALE

Image gray-level scaling and quantization


EnvironmentsPYTHON :: EASI :: MODELER
Batch ModeYes
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Algorithm :: Related

Back to top

Description


SCALE performs linear or nonlinear mapping of gray levels in images to a specified output range. You can use SCALE to scale data from high-resolution (32 and 16-bit) channels to low-resolution (8 and 16-bit) channels. Available algorithms include scaling with tail trimming and enhancement (using linear, squared, logarithmic, square root, or general power functions), automatic normalized quantization, and equal-area quantization.
Back to top

Parameters


Name Type Length Value range
Input: Unscaled raster layer or layers* Raster port 1 - 1024  
Output: Scaled raster layer or layers Raster port 0 - 1024  
Minimum input gray level Float 0 - 2  
Maximum input gray level Float 0 - 2  
Left tail-trimming percentage Float 0 - 1 Default: 0.0,0.0
Right tail-trimming percentage Float 0 - 1 Default: 0.0,0.0
Minimum output gray level Float 0 - 1  
Maximum output gray level Float 0 - 1  
Scaling function String 0 - 1 LIN | SQR | ROOT | POW | LOG | NQ | EQ
Default: LIN
Exponent Real 0 - 1 0.1 <= n <= 10
Output type: Channel type Text port 0 - 4  

* Required parameter
Back to top

Parameter descriptions

Input: Unscaled raster layer or layers

The input channel or channels to process.

Output: Scaled raster layer or layers

The channels to which to write the processed image data.

When your output file is a new file; that is, it does not exist already, you need not specify a value for this parameter; all channels in the new file will be of the bit depth specified by the value of the DATATYPE parameter.

The number of output channels you specify must be the same as the number of input channels.

If the output channel is the same as the input channel, the input channel data is overwritten.

This parameter is optional.

Minimum input gray level

The minimum pixel value of the input range.

If no value is specified for this parameter, SCALE calculates the range from the image data based on the tail-trimming levels.

If the number of input channels is greater than one, and you specify a minimum level, this level is used for each input channel.

This parameter is optional.

Maximum input gray level

The maximum pixel value of the input range.

If no value is specified for this parameter, SCALE, calculates the range from the image data based on the tail-trimming levels.

If the number of input channels is greater than one, and you specify a maximum value, this level is used for each input channel.

This parameter is optional.

Left tail-trimming percentage

The percentage of tail trimming to apply to the low tail of the input image histogram before scaling.

When you specify a value for the Minimum input gray level and Maximum input gray level parameters, that range is used and Left tail-trimming percentage and Right tail-trimming percentage are ignored. If you do not specify a value for the two preceding parameters, the minimum and maximum values of image data for each input channel are used for the input range.

The Left tail-trimming percentage and Right tail-trimming percentage parameters are useful only for scaling algorithms (LIN/SQR/LOG). The two quantization algorithms squeeze tails automatically.

This parameter is optional.

Right tail-trimming percentage

The percentage of tail trimming to apply to the high tail of the input image histogram before scaling.

When you specify a value for the Minimum input gray level and Maximum input gray level parameters, the specified input range is used while "Left Tail Trimming %" and "Right Tail Trimming %" are ignored.

When you specify a value for the Minimum input gray level and Maximum input gray level parameters, that range is used and Left tail-trimming percentage and Right tail-trimming percentage are ignored. If you do not specify a value for the two preceding parameters, the minimum and maximum values of image data for each input channel are used for the input range.

The Left tail-trimming percentage and Right tail-trimming percentage parameters are useful only for scaling algorithms (LIN/SQR/LOG). The two quantization algorithms squeeze tails automatically.

This parameter is optional.

Minimum output gray level

The target minimum pixel value, after scaling.

When the number of output channels is greater than one, the minimum and maximum pixel values are used for each output channel.

This parameter is optional.

Maximum output gray level

The target maximum pixel value, after scaling.

When the number of output channels is greater than one, the minimum and maximum pixel values are used for each output channel.

This parameter is optional.

Scaling function

The scaling function or quantization algorithm.

You can choose from the following options:

This parameter is optional.

Exponent

The exponent to use when you select the POW option for the Scaling function parameter.

This parameter is optional.

Output type: Channel type

The image data type of the output channels.

The supported types are:
Back to top

Details

SCALE maps the pixel values of the input raster to the pixel values of the output raster. Typically, you use SCALE to reduced the scale and quantize imagery in a high-resolution (32-bit or 16-bit) channel to a fewer number of pixel values to fit into a low-resolution (16-bit or 8-bit) channel. You can also use SCALE to visually enhance the input image by stretching or shifting the dynamic range.

Several scaling functions are available to perform the mapping:

By using the tail trimming levels (or by specifying an input range as a subrange within the image data range), you can exclude outlier values so as to increase the useful dynamic range in the output image.

Two more algorithms are provided for image pixel value quantization:

Both quantization algorithms first attempt to estimate the histogram of the input image, then use it to build a mapping table. They do not require the input range (INRANGE) and trimming level (TRIM) parameters. The output of the two quantization algorithms can only be integer levels.

Back to top

Algorithm

SCALE estimates the input image histogram by randomly sampling the image data and sorting the samples. This avoids binning (and, hence, prescaling) the data and, therefore, the resolution of the estimated histogram is not affected by extreme outlier values.

The quantization algorithms derive an inverse mapping table (from output levels to input intervals) based on the histogram. They then transform the pixels by looking up the table using a binary search.

In the automatic normalized quantization algorithm, the mapping function is in the form of:

sigmoid(x) = 1/(1 + exp(-x))
  

With properly scaled input and output variables based on the estimated histogram. The median level of the input image is always mapped to the middle of the output range.

In the tail-trimming scaling algorithms, the threshold gray levels at the specified tail percentage are determined from the estimated histogram.

To exclude a large area of background values from the estimated histogram, any multiple occurrences of the lowest and highest values among the samples are ignored.

Outliers

An important consideration in using SCALE is reducing the influence of outlier values on the scaling procedure. Outliers are the few pixels in an image with extremely high or low pixel values in comparison to the majority of pixels. For example, the radar image in channel 11 of irvine.pix has approximately 99 percent of pixel values in the range of 0 to 2,200. But some extreme pixel values are over 16,000.

If the image is linearly scaled to 8-bit, the useful data range will be squeezed to approximately 30 out of the 256 gray levels; a large portion of the dynamic range is occupied by the one percent outlier pixels. To efficiently use the output dynamic range, you can specify tail-trimming levels so that the highest or lowest portions of gray levels are excluded from being used in calculating the scaling function.

The automatic normalized quantization algorithm uses a smooth nonlinear function to map the input range of (-Infinity, Infinity) to a closed output range. The function automatically compresses extreme gray levels. Unlike tail-trimming approaches, using the smooth nonlinear function also has the advantage of not introducing high peaks at the two extreme bins of the output histogram.

The equal-area quantization procedure is also robust against outlier values.

After the scaling-and-quantization process, the ideal output histogram should fully occupy the dynamic range with no unnecessary empty or sparsely occupied slots in the middle. It is also advantageous that distortion to the image histogram is minimized.

NoData values

If the input data has the NO_DATA_VALUE metadata tag then any output pixel values scaled to the NO_DATA_VALUE are adjusted away from the NO_DATA_VALUE by 1 or -1. If the NO_DATA_VALUE is not present then all pixels are considered valid and no adjustments away from NoData are done.

© PCI Geomatics Enterprises, Inc.®, 2024. All rights reserved.