Label | Explanation | Data Type |
Input Raster | A multiband or hyperspectral image. | Raster Dataset; Raster Layer; Mosaic Dataset; Mosaic Layer; Image Service |
Output Raster | A single band raster that stores the anomaly scores between 0-1 as a floating point number. Zero (0) is the background value, and large values approaching 1 are potential anomaly pixels. Use the file extension to specify the output format, including .tif (TIFF), .crf (CRF), .mrf (MRF), and .dat (ENVI DAT). | Raster Dataset |
Anomaly Calculation Method (Optional) | Specifies the anomaly calculation method that will be used.
| String |
Number of Clusters (Optional) | The number of clusters that will be used when the Anomaly Calculation Method parameter is set to KMEANS. | Long |
Background Region (Optional) | A polygon feature class that will define the region to be used to calculate background statistics when the Anomaly Calculation Method parameter is set to RXD or UTD. | Feature Set |
Recompute Statistics (Optional) | Specifies whether statistics will be recomputed for the input raster when the Anomaly Calculation Method parameter is set to RXD or UTD. The RXD and UTD options require accurate statistics in which the skip factor must be 1 when statistics are computed.
| Boolean |
Available with Image Analyst license.
Summary
Processes a multiband or hyperspectral image and creates an anomaly score raster. An anomaly score raster is a single band raster, with values between 0 and 1.
Usage
An anomaly in an image refers to pixels that are significantly different from the background values, such as ships in the ocean, vehicles on a road, or human development in natural areas. The tool supports the Reed-Xiaoli Detector (RXD), Uniform Target Detector (UTD), and KMEANS image anomaly detection methods.
The RXD option of the Anomaly Calculation Method parameter calculates the pixels’ Mahalanobis distance to the background that is defined by the mean. It has the following formula:
δRXD(r)=(r-µ)TK-1LxL(r-µ)
Where r is the sample pixel spectra, µ is the mean spectra, K is covariance, and L is the number of bands.
The UTD option of the Anomaly Calculation Method parameter is similar to the RXD option but extracts a background using a unit vector. It has the following formula:
δUTD(r)=(1-µ)TK-1LxL(1-µ)
Which defines the anomaly by replacing (r-u) in the RXD method with (1-u).
The KMEANS option of the Anomaly Calculation Method parameter identifies pixels that deviate significantly from the established clusters in the data using K-means clustering algorithms.
The output is an anomaly score raster with decimal values between 0 and 1, where 0 is the background and large values approaching 1 are potential anomalies. The anomaly pixels can be filtered using raster functions, such as the Remap or Mask function. The entire anomaly detection workflow can be performed using the Anomaly Detection Wizard.
Use Dynamic Range Adjustment (DRA) in the output layer symbology to better visualize anomaly pixels.
Parameters
DetectImageAnomalies(in_raster, out_raster, {method}, {num_cluster}, {background_region}, {recompute_stats})
Name | Explanation | Data Type |
in_raster | A multiband or hyperspectral image. | Raster Dataset; Raster Layer; Mosaic Dataset; Mosaic Layer; Image Service |
out_raster | A single band raster that stores the anomaly scores between 0-1 as a floating point number. Zero (0) is the background value, and large values approaching 1 are potential anomaly pixels. Use the file extension to specify the output format, including .tif (TIFF), .crf (CRF), .mrf (MRF), and .dat (ENVI DAT). | Raster Dataset |
method (Optional) | Specifies the anomaly calculation method that will be used.
| String |
num_cluster (Optional) | The number of clusters that will be used when the method parameter is set to KMEANS. | Long |
background_region (Optional) | A polygon feature class that will define the region to be used to calculate background statistics when the method parameter is set to RXD or UTD. | Feature Set |
recompute_stats (Optional) | Specifies whether statistics will be recomputed for the output score raster when the method parameter is set to RXD or UTD. The RXD and UTD options require accurate statistics in which the skip factor must be 1.
| Boolean |
Code sample
This example processes a hyperspectral image using the RXD option and creates an anomaly score raster.
# Import system modules
import arcpy
from arcpy.ia import *
# Check out the ArcGIS Image Analyst extension license
arcpy.CheckOutExtension("ImageAnalyst")
tempanomaly = arcpy.ia.GenerateMultidimensionalAnomaly(
"c:/data/climateData.nc", "temperature", "DIFFERENCE_FROM_MEAN",
"ALL", "DATA", None)
tempanomaly.save("c:/data/TempAnomaly.crf")
This example processes a hyperspectral image using the KMEANS option and creates an anomaly score raster.
# Import system modules
from arcpy.ia import *
# Check out the ArcGIS Image Analyst extension license
arcpy.CheckOutExtension("ImageAnalyst")
#Define variables
input_image = r"c:\data\hsi_image.tif"
num_of_cluster = 1
anomaly_raster = arcpy.ia.DetectImageAnomalies(
in_raster=input_image,
method="KMEANS",
num_cluster=num_of_cluster,
recompute_stats="RECOMPUTE_STATS"
)
anomaly_raster.save(r"c:/test/anomaly_score_raster.tif")
Environments
Licensing information
- Basic: Requires Image Analyst
- Standard: Requires Image Analyst
- Advanced: Requires Image Analyst