PolygonClassStatistics

计算训练多边形集的统计信息。

描述

处理一组用于训练的几何图形(它们应该有一个字段来指定相关的类)。对照支撑图像分析几何图形以计算统计数据:

  • 每班样本数
  • 每个几何体的采样数

可以使用可选的栅格蒙版来丢弃样本。支持不同类型的几何体:多边形、直线、点。每种类型的几何体的行为都不同:

  • 多边形:选择中心位于多边形内部的像素
  • 直线:选择与直线相交的像素
  • 点:选择距离点最近的像素

参数

Input image -in image Mandatory
Support image that will be classified

Input validity mask -mask image
Validity mask (only pixels corresponding to a mask value greater than 0 will be used for statistics)

Input vectors -vec vectorfile Mandatory
Input geometries to analyze

Output XML statistics file -out filename [dtype] Mandatory
Output file to store statistics (XML format)

Field Name -field string
Name of the field carrying the class name in the input vectors.

Layer Index -layer int Default value: 0
Layer index to read in the input vector file.

高程管理

这组参数允许管理高程值。

DEM directory -elev.dem directory
This parameter allows selecting a directory containing Digital Elevation Model files. Note that this directory should contain only DEM files. Unexpected behaviour might occurs if other images are found in this directory. Input DEM tiles should be in a raster format supported by GDAL.

Geoid File -elev.geoid filename [dtype]
Use a geoid grid to get the height above the ellipsoid in case there is no DEM available, no coverage for some points or pixels with no_data in the DEM tiles. A version of the geoid can be found on the OTB website (egm96.grd and egm96.grd.hdr at https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/tree/master/Data/Input/DEM).

Default elevation -elev.default float Default value: 0
This parameter allows setting the default height above ellipsoid when there is no DEM available, no coverage for some points or pixels with no_data in the DEM tiles, and no geoid file has been set. This is also used by some application as an average elevation value.


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

实例

从命令行执行以下操作:

otbcli_PolygonClassStatistics -in support_image.tif -vec variousVectors.sqlite -field CLASS -out polygonStat.xml

来自Python的评论:

import otbApplication

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

app.SetParameterString("in", "support_image.tif")
app.SetParameterString("vec", "variousVectors.sqlite")
app.SetParameterString("field", "CLASS")
app.SetParameterString("out", "polygonStat.xml")

app.ExecuteAndWriteOutput()