Using the Stretching process

LegacyLegacy:

ArcGIS 10 is the last release of the stand-alone ArcGIS Image Server product. The image service definition (.ISDef) has been replaced by an improved geodatabase data model—the mosaic dataset—which can be published as an image service using the ArcGIS Server Image extension.

Stretching is used to enhance an image by changing its brightness, contrast, and gamma.

Brightness

Brightness is an attribute of visual perception in which a source appears to emit a given amount of light. Brightness allows you to increase the overall lightness of the image—for example, making dark colors lighter and light colors whiter. When displaying an image in an 8-bit environment, you are generally displaying each band across a measure of brightness from 0 to 255. By changing these upper or lower brightness values, you can either darken the image by reducing the higher number or lighten the image by increasing the lower number.

In the example below, you can see the original image and its histogram, on top, with the values stretched between 0 and 255. The bottom left image has been made darker by only stretching the pixel values from 0 to 150, whereas the right image has been made brighter by only stretching the pixel values from 60 to 255. Both stretches were linear.

Brightness examples

Contrast

Contrast is the ratio of luminance between the brightest white and darkest black that can be produced for an image. Contrast allows you to adjust the difference between the darkest and lightest colors.

In the example below, you can see the original image and its histogram, on the left, with the pixel values between 0 and 255. The pixel values were adjusted in the image on the right by linearly stretching all values between 52 and 170 from 0 to 255. All values below 52 were treated as 0, and all values above 170 were treated as 255.

Contrast example

Gamma

When preparing imagery for computer display, gamma refers to the degree of contrast between the midlevel gray values of an image. Gamma does not affect the black or white values in an image, only the middle values. By applying a gamma correction, you can control the overall brightness of an image. If the gamma value is set too high, middle tones appear too dark; however, if the gamma value is set too low, middle tones appear too light and the image looks bleached out. Gamma changes not only the brightness but also the ratios of red to green to blue.

Gamma examples

Stretching process properties

The Stretching Process Properties dialog box enables you to define the parameters that determine how a lookup table is created, which will apply the stretch to an image. The lookup table defines a corresponding output pixel value for each input pixel value. The default lookup table represents a straight line from 0,0 to 256,256, providing a linear stretch from the input pixel values to the output pixel values. The lookup table is formed by a line passing through the following points:

0,0
Input Min, Output Min
Input Low, Output Low
Gamma Function curve
Input Up, Output Up
Input Max, Output Max
255,255

There are three ways to enter the parameters on the Stretching Process Properties dialog box: you can type the values for the Input, Output, and other parameters; you can enter percentages rather than specific values in the Input and Gamma sections; or you can adjust the sliders on the box to help you define the values for each parameter.

Stretching process dialog box

The values you enter can range from 0 to 255, irrespective of the number of bits in the image. Therefore, even for a 16-bit image, the values are entered from 0 to 255. The values do not need to be integers; they can be entered as fractions where appropriate. For example, 0.1 (0.1 x 65536/256) can be used for a 16-bit image. Stretching can be applied to up to three input bands that have unsigned 8-bit or unsigned 16-bit pixels with an input color space of either grayscale or RGB. Additionally, if you want to convert from 16-bit to 8-bit or 8-bit to 16-bit, you can use the Output bit depth drop-down arrow to select the output.

Percentage values are recommended when you don't know the exact pixel values to enter; using them enables you to get an optimal histogram stretch. This is synonymous with the percentile enhancement option you often get when adding raster data to an image service definition. To learn more about this, see Applying an enhancement to data added to an image service definition. Each time a request is made to the service provider for an image, either by a client's display or for a print or export operation, a histogram is generated on the fly for the extent, and the percentage values are used to determine the pixel values defining the input ranges. The percentage values can be entered either for all the bands or specifically for each band. The values are entered with a percent sign at the end, for example, 0.05%, 0.1%, or 1.0%.

The gamma value represents a nonlinear curve that has a form similar to the power function of light. A gamma value of 1 is a straight line. Gamma values lower than 1 result in an increase in the contrast in the darker areas and a decrease in the contrast in the lighter areas. This results in a darkening of the image but in such a way that there is no saturation of the dark or light areas of the image. You can enter percentage values in the Gamma section. As described above, a histogram is generated on the fly for the extent and the percentage values are used to determine the actual gamma value.

When working with a three-band or single-band image, you can adjust the values under the RGB/Gray heading. If you want to use a stretch that is not uniform for each band, enter the values under the columns identified by each colored bar. Therefore, if you only enter values in the column under the red bar, only the red band in your RGB image will be altered.

The _AutoStretch_ process that may appear on the Raster Properties dialog box uses this same stretching dialog box and is therefore the same process; however, it is added to the process chain when the data is added to an image service definition and an enhancement is defined.

Learn about applying an enhancement to data added to an image service definition

NoteNote:

It is recommended that you adjust the Stretch parameters in the Raster Properties dialog box when a service created with 16-bit imagery appears black.

Related Topics


4/19/2011