SpectralAngleClassification¶
使用光谱测量对图像进行分类。
描述¶
这个应用程序使用一组参考像素在高光谱数据立方体上计算光谱测量。然后,通过为每个像素找到其最接近端元的索引,即对应于最低测量值的端元,来对图像进行分类。输出分类标记为从1到L,L是端元数。可以为分类步骤设置阈值,只有低于该阈值的测量值将被考虑,其他将被分类为 background values (默认值为0)。
有两种测量方法:光谱角度映射器和光谱信息散度。看见 [1] 有关详情
这个应用程序有几个输出图像,并支持“多写”。不是独立地计算和写入每个图像,而是以同步的方式为每个输出写入流图像块。输出图像将逐条计算,使用可用的RAM计算条带大小,并且可以使用流扩展文件名(类型、模式和值)指定用户定义的流模式。请注意,可以使用多写扩展文件名选项禁用多写,在这种情况下,将逐个写入输出图像。请注意,MPI编写器不支持多重写入。
参数¶
Input Image Filename -in image
Mandatory
The hyperspectral data cube input
Input endmembers -ie image
Mandatory
The endmembers (estimated pure pixels) to use for unmixing. Must be stored as a multispectral image, where each pixel is interpreted as an endmember.
Output spectral angle values -measure image [dtype]
Output image containing for each pixel from the input image the computed measure relative to each endmember
Output classified image -out image [dtype]
Output classified image, classified pixels are labeled from 1 to L, L being the number of endmember in the image.
Measure used for classification -mode [sam|sid]
Default value: sam
Measure used for classification
- Spectral angle mapper
Spectral angle mapper (SAM) measure. - Spectral information divergence
Spectral information divergence (SID) measure. Input pixel values should be strictly positive.
Classification threshold -threshold float
Pixel with a measurement greater than this threshold relatively to a reference pixel are not classified. The same threshold is used for all classes.
Background value -bv int
Default value: 0
Value of unclassified pixels in the classification image (this parameter is only used if a threshold is set).
Available RAM (MB) -ram int
Default value: 256
Available memory for processing (in MB).
实例¶
从命令行执行以下操作:
otbcli_SpectralAngleClassification -in cupriteSubHsi.tif -ie cupriteEndmembers.tif -out classification.tif -measure measure.tif -mode sam -threshold 0.1
来自Python的评论:
import otbApplication
app = otbApplication.Registry.CreateApplication("SpectralAngleClassification")
app.SetParameterString("in", "cupriteSubHsi.tif")
app.SetParameterString("ie", "cupriteEndmembers.tif")
app.SetParameterString("out", "classification.tif")
app.SetParameterString("measure", "measure.tif")
app.SetParameterString("mode","sam")
app.SetParameterFloat("threshold", 0.1)
app.ExecuteAndWriteOutput()
局限性¶
在sid模式中,输入图像和输入端元的像素应严格为正。端子成员图像已完全加载到内存中。