Raster histogram stretching

Histogram contrast stretching allows you to customize a contrast stretch by interactively adjusting the histogram. Typically, ArcGIS Pro displays the image and raster data with good contrast by default. When the preset contrast stretches do not produce the enhancement you want, histograms can be manually adjusted to change the contrast stretch of the raster.

The histogram of the contrast stretch shows you the distribution of the image pixels. The pixel values are along the x-axis, and the pixel counts are shown on the y-axis as a histogram. The histogram does not show every pixel's value due to binning of values.

Not all of the stretch types allow you to edit the histogram. The None and Esri stretch types only allow you to view the pixel distribution. The Minimum Maximum, Percent Clip, and Standard Deviation stretch types allow you to view the pixel distribution and interactively set the minimum and maximum input values so that the stretch focuses on the majority of the input values and disregards the outliers or tails of the distribution at either extreme. The Custom and Histogram Specification stretch types allow you to interactively create a piecewise histogram stretch to enhance specific portions of the histogram differently.

Stretch typeHistogram capability

  • None
  • Histogram Equalize
  • Esri

The histogram is read-only.

  • Minimum Maximum
  • Percent Clip
  • Standard Deviation

The minimum and maximum values of the histogram can be manually adjusted.

  • Histogram Specification

The histogram can be matched to an existing histogram file (.xml). Additionally, you can manually specify a piecewise histogram.

  • Custom

You can manually specify a piecewise histogram.

This allows you to create a custom stretch, where each portion of the histogram can be stretched differently.

Histogram tools

The table below shows the various histogram tools available.

ToolDescription

Band Selector

RGB Selector

Use the drop-down list to select which band to display.

  • RGB—Display the histogram for all three bands.
  • Red—Only display the red histogram.
  • Green—Only display the green histogram.
  • Blue—Only display the blue histogram.

Choosing a single band is helpful when you want to see more detail for the Y-axis.

This is only available when the RGB Symbology type is used.

Line

Edit Histogram Line

The line tool creates a set of vertices, where the input values map to the output display values using the breakpoints. Use the Line tool to edit the piecewise line on the graph, which displays the stretched histogram superimposed over the original input histogram.

For instance, if you want the input value of 20 to be displayed as 30, place a point where the input (x) is 20 and the output (y) is 30. Once you complete the custom input and output values, click Apply to see the resulting stretch.

This tool is only available when the Stretch type is Histogram Specification or Custom.

Spline

Edit Histogram Spline

The spline tool create a set of vertices, where the input values map to the output display values; making sure the input-output line will be curved through the breakpoints. Used to edit the piecewise line on the graph, which displays the stretched histogram superimposed over the original input histogram.

For instance, if you want the input value of 20 to be displayed as 30, place a point where the input (x) is 20 and the output (y) is 30. Once you complete the custom input and output values, click Apply to see the resulting stretch.

This tool is only available when the Stretch type is Histogram Specification or Custom.

Add a point

Manually Add Input and Output

Expand the Manually add input and output category to see text boxes for x- and y-input.

This functionality is similar to that of the Line tool, except instead of using the graphical display to set points, you type the input and output values in the text boxes. Once you set the input and output, click the Add a point button to add the breakpoint to the histogram.

This tool is only available when the Stretch type is Histogram Specification or Custom.

Smooth

Smooth Histogram

The Smooth button is used to smooth the curve rather than abrupt changes occurring at your breakpoint settings.

This tool is only available when the Stretch type is Histogram Specification or Custom.

Information for selected area

Information For Selected Area

The Information For Selected Area tool is used to highlight a portion of the histogram and the highlighted data is shown in the Information section.

Zoom in

Fixed Zoom In

Click the Zoom in button to magnify the X-axis. This is useful to see an area where many of the values are densely grouped.

Zoom out

Fixed Zoom Out

Click the Zoom in button to reduce the X-axis.

Cumulative

Display Cumulative Histogram

The Cumulative button is used to change the display of the graph. Instead of showing the histogram distribution, two ascending curves are displayed, showing the input and output values for the input data and the stretched values. To return to the histogram view, click the Cumulative button again to turn off the cumulative view.

Reset

Reset

The Reset button is used to reset the histogram and the zoom level as well.

View the histogram

You can view the raster histogram distribution when the RGB or Stretch symbology type is used in the Symbology pane. There are two methods to open the histogram view:

  • Click the Stretch Type button Stretch Type located on the Raster Layer, Mosaic Layer, or Image Service Layer tab.
    Note:

    If the stretch type is currently None and you click the Stretch button before you choose a different stretch type, you can only view the histogram. To adjust the histogram, change the Stretch type setting from the Symbology pane or use the arrow below the Stretch Type button, from the Raster Layer, Mosaic Layer, or Image Service Layer tab.

  • Click the Histogram button Raster Histogram Stretch in the Symbology pane.

The histogram displays the low and high breakpoint values along the histogram distribution where the histogram will be clipped. It also displays the histogram distribution for each rendered band in the image.

This histogram is viewable for all the stretch types; additionally, some of the stretch types allow you to edit the histogram. Below the histogram display is a Statistics section that shows the statistics of the data source. In the Information section, you can see input and output information for any location on the histogram by hovering the pointer over the histogram.

Edit the minimum and maximum values

When the stretch type is set to Minimum Maximum, Percent Clip, or Standard Deviation, you can view the histogram and also edit the minimum and maximum values of the histogram. When you set the high and low limits of the histogram, it adjusts the contrast stretch of the image. This helps to remove outlier values in high and low regions of the histogram.

To set the minimum and maximum histogram limits, click and hold the minimum or maximum triangle located below the dotted line, and move the breakpoint line along the x-axis to where you want to set the limit. You can use the graphical histogram display to determine where the limits should be set. If you know the minimum and maximum values you want to set, you can also double-click the minimum or maximum value, and type the number in the text box.

If you are displaying your histogram with the RGB renderer, it will display all three histograms at once. You can use the Band Selector RGB Selector to display one band at a time. This will show you the histogram of the selected band, with a much taller y-axis.

To see more detail in the X-axis, use the Zoom in button Fixed Zoom In. While zoomed in, you can also pan left or right to see other parts of the histogram distribution. To see the entre histogram distribution at once, you can click the Zoom in button Fixed Zoom Out.

Once the histogram has been edited, the Histogram button Open edited histogram in the Symbology pane is updated to show that the histogram was updated.

Custom and Histogram Specification

When the stretch type is set to Histogram Specification, you can select a histogram file (.xml) to set the layer's histogram.

When the stretch type is set to Custom or Histogram Specification, you can interactively specify a piecewise histogram.

Click the Histogram button Open Histogram Page to open the Histogram page. For each rendered band, the histogram has a line that maps the input x-value and the stretched y-value. Initially this line is a straight diagonal from the lower left origin (minimum input, minimum output) to the upper right of the histogram graph (maximum input, maximum output). You place and adjust histogram stretch breakpoints along this line to create the piecewise histogram stretch.

If you are displaying your histogram with the RGB renderer, it will display all three histograms at once. You can use the Band Selector RGB Selector to display one band at a time. This will show you the histogram of the selected band, with a much taller y-axis.

To see more detail in the X-axis, use the Zoom in button Fixed Zoom In. While zoomed in, you can also pan left or right to see other parts of the histogram distribution. To see the entre histogram distribution at once, you can click the Zoom in button Fixed Zoom Out.

You can use the following tools to edit the histogram, and you can manually add input and output:

  • Line tool Edit Histogram Line
  • Spline tool Edit Histogram Spline

The Line tool Edit Histogram Line is used to edit the piecewise line on the graph, which displays the stretched histogram superimposed over the original input histogram. This line sets how to map the output display values. Use the Line tool to create a set of vertices, where the input values map to the output display values. For instance, if you want the input value of 20 to be displayed as 30, place a point where the input (x) is 20 and the output (y) is 30. Once you complete the custom input and output values, click Apply to see the resulting stretch.

The Spline tool Edit Histogram Spline works similar to the Line tool, except the input-output line will be curved through the breakpoints.

Open the Manually add input and output category to see text boxes for x- and y-input. This functionality is similar to that of the Line tool, except instead of using the graphical display to set points, you type the input and output values in the text boxes and click the Add a point button Manually Add Input and Output to add another breakpoint to the histogram.

You can move any of the vertices to edit them; drag the vertex to the desired position on the histogram. To remove any of the vertices, hover over the vertex, click it, right-click, and choose Delete selected point. The Smooth button Smooth Histogram is used to smooth the curve rather than abrupt changes occurring pursuant to your breakpoint settings.

While you view the histogram, there are several tools you can use to query the data. The Information For Selected Area tool Information For Selected Area is used to highlight a portion of the histogram and the highlighted data is shown in the Information section. The Cumulative button Display Cumulative Histogram is used to change the display of the graph. Instead of showing the histogram distribution, two ascending curves are displayed, showing the input and output values for the input data and the stretched values. To return to the histogram view, click the Cumulative button again to turn off the cumulative view.

Once the histogram has been edited, the Histogram button Open edited histogram in the Symbology pane is updated to show that the histogram was updated.

Related topics