ZonalStatistics

此应用程序计算区域统计数据

描述

这个应用程序从标签图像或矢量数据计算区域统计数据。该应用程序输入一个输入多波段图像,另一个输入用于区域定义。可以使用标签图像(inzone.Lablimage.in)或矢量数据图层(inzone.vetor.in)定义区域。计算每个区域的以下统计数据:平均值、最小值、最大值和标准差。统计数据可在矢量图层中导出(如果输入区域定义为标注图像,则将被矢量化)或导出为XML文件

参数

Input Image -in image Mandatory

Background value to ignore in statistics computation -inbv float

Type of input for the zone definitions -inzone [vector|labelimage] Default value: vector

  • Input objects from vector data
  • Input objects from label image

从矢量数据选项输入对象

Input vector data -inzone.vector.in vectorfile Mandatory

Reproject the input vector -inzone.vector.reproject bool Default value: false

标签图像选项中的输入对象

Input label image -inzone.labelimage.in image Mandatory

No-data value for the input label image -inzone.labelimage.nodata int


Format of the output stats -out [vector|xml|raster] Default value: vector

  • Output vector data
  • Output XML file
  • Output raster image

输出矢量数据选项

Filename for the output vector data -out.vector.filename vectorfile Mandatory

输出XML文件选项

Filename for the output xml file -out.xml.filename string Mandatory

输出栅格图像选项

File name for the raster image -out.raster.filename image [dtype] Mandatory

Background value for the output raster -out.raster.bv float


Available RAM (MB) -ram int Default value: 256
Available memory for processing (in MB).

实例

从命令行执行以下操作:

otbcli_ZonalStatistics -in input.tif -inzone.vector.in myvector.shp -out.vector.filename myvector_with_stats.shp

来自Python的评论:

import otbApplication

app = otbApplication.Registry.CreateApplication("ZonalStatistics")

app.SetParameterString("in", "input.tif")
app.SetParameterString("inzone.vector.in", "myvector.shp")
app.SetParameterString("out.vector.filename", "myvector_with_stats.shp")

app.ExecuteAndWriteOutput()

局限性

  1. Inzone.vetor.in必须适合内存(如果“InZone”为“VECTOR”)。2)矢量化的标签图像也必须放入内存中(如果“out”是“VECTOR”):如果不是,考虑使用“out”to“xml”