Anomaly Detection Tutorial

The Anomaly Detection workflow uses the Reed-Xiaoli Detector (RXD) algorithm to identify the spectral or color differences between a region to test and its neighboring pixels or the entire dataset. This algorithm extracts targets that are spectrally distinct from the image background. RXD is effective when the anomalous targets are sufficiently small, relative to the background. Results from RXD analysis are unambiguous and have proven very effective in detecting subtle spectral features. ENVI implements the standard RXD algorithm:

RXD equation

Where r is the sample vector, μ is the sample mean, and KLxL is the sample covariance matrix.

RXD works with multispectral and hyperspectral images. Bad pixels or lines appear as anomalous, but they do not affect the detection of other, valid anomalies. As with any spectral algorithm, exclusion of bad bands increases the accuracy of results. Currently, this algorithm does not differentiate detected anomalies from one another.


Chang, Chein-I, and Shao-Shan Chiang, 2002. Anomaly detection and classification for hyperspectral imagery. IEEE Transactions on Geoscience and Remote Sensing, Vol. 40, No. 6, pp. 1314-1325.

Reed I. S., and X. Yu, Adaptive multiple-band CFAR detection of an optical pattern with unknown spectral distribution. IEEE Trans. Acoustics, Speech and Signal Proc. 38, pp. 1760-1770, October 1990.

See the following for help on a particular step of the workflow:

Select a File for Anomaly Detection

  1. From the Toolbox, select Anomaly Detection > Anomaly Detection Workflow. Select an input file from the File Selection dialog.

  2. To apply a mask, select the Input Mask tab in the File Selection panel.

  3. Click Next. The Anomaly Detection panel appears and the file opens in a new workflow view. If the selected file is displayed in an active view before you start the workflow, the display bands and image location are retained, as well as any brightness, contrast, stretch, and sharpen settings. The image location is not retained for pixel-based images or those with pseudo or arbitrary projections.

Anomaly Detection Settings

  1. In the Anomaly Detection panel, select one of the following options from the Anomaly Detection Method drop-down list:
    • RXD Standard RXD algorithm. This is the default setting.
    • UTD Uniform Target Detector, in which the anomaly is defined using (1 - μ) as the matched signature, rather than (r - μ). UTD and RXD work exactly the same, but instead of using a sample vector from the data (as with RXD), UTD uses the unit vector. UTD extracts background signatures as anomalies and provides a good estimate of the image background.
    • RXD-UTD A hybrid of the RXD and UTD methods, in which (r - 1) is used as the matched signature. This is a variant of the UTD approach. Subtracting UTD from RXD suppresses the background and enhances the anomalies of interest. The best condition to use RXD-UTD is when the anomalies have an energy level that is comparable to, or less than, that of the background. In this case, using UTD by itself does not detect the anomalies, but using RXD-UTD enhances them.
  2. Select the Mean Calculation Method to use from the drop-down list. You can specify whether the mean spectrum should be derived from the full dataset (Global) or from a localized kernel around the pixel (Local). The default is Global.
  3. If you choose Local, for the Mean Calculation Method,the Kernel Size field is enabled. Specify a kernel size, in pixels, around a given pixel that will be used to create a mean spectrum. The default value is 9. The allowable range is from 9 to 99, and the value must be an odd number (e.g., 9 = 9x9 pixels).
  4. Enable the Suppress Vegetation check box to optionally suppress vegetation anomalies in the RXD results. This option is best used when vegetation is a minor component of the image. It works by calculating a Normalized Difference Vegetation Index (NDVI) for the input image, then re-scaling the RXD results inversely proportional to the NDVI.
  5. To preview how the anomaly detection will look before processing, enable the Preview check box. A Preview Window appears. The Preview Window works with full or higher resolution views. You can change the anomaly detection settings and preview the results again, as needed. If either the image lines or samples is greater than 1024 pixels and you want to zoom out of the data, you cannot zoom out further than 50% because it will significantly increase processing time and delay the previewed data from displaying. Zooming out further than 50% will result in a black Preview Window.
  6. Click Next. Anomaly detection processing begins.

    When processing is complete, the Anomaly Thresholding panel appears.

Anomaly Thresholding

In the Anomaly Thresholding panel, you can optionally set the Anomaly Percentage Threshold. This value segments the image into anomalous and non-anomalous regions. The threshold should be set low enough to minimize false positives without omitting real anomalies.

When thresholding is complete, the Export panel appears.

Export Anomaly Detection Results

  1. In the Export Files tab of the Export panel, enable the output options you want. The following are available:
    • Export Anomaly Detection Image saves the thresholding result to an ENVI raster.
    • Export Anomaly Detection Vector saves the vectors created during thresholding. The supported vector output formats are shapefile and ArcGIS geodatabase. The output area units are in square meters.
    • Note: Depending on the image size, exporting to vectors may be time-consuming. To reduce the export time, performing the Cleanup step prior to export is recommended.

  2. In the Additional Export tab, enable any other output options you want. The following are available:
    • Export Anomaly Detection Statistics saves statistics on the thresholding image.The output area units are in square meters.
    • Export Unthresholded Anomaly Detection Image saves the unthresholded anomaly detection image to an image. The supported image output formats are ENVI, ArcGIS geodatabase, and TIFF.
  3. Click Finish to create the output, add the new layers to the Layer Manager, and save the files to the directories you specified. When the export is complete, the workflow view closes. The original data and the export data display in the Image window view.

Related Topics

RX Anomaly Detection, SPEAR Anomaly Detection, THOR Anomaly Detection