Polygon Class Statistics

Computes statistics on a training polygon set.

Detailed description

The application processes a set of geometries intended for training (they should have a field giving the associated class). The geometries are analysed against a support image to compute statistics :
  • number of samples per class
  • number of samples per geometry
An optional raster mask can be used to discard samples. Different types of geometry are supported
: polygons, lines, points. The behaviour is different for each type of geometry :
  • polygon: select pixels whose center is inside the polygon
  • lines : select pixels intersecting the line
  • points : select closest pixel to the point

Parameters

This section describes in details the parameters available for this application. Table [1] presents a summary of these parameters and the parameters keys to be used in command-line and programming languages. Application key is PolygonClassStatistics .

[1]Table: Parameters table for Polygon Class Statistics.
Parameter Key Parameter Type Parameter Description
in Input image Input image
mask Input image Input image
vec Input File name Input File name
out Output File name Output File name
field List List
layer Int Int
elev Group Group
elev.dem Directory Directory
elev.geoid Input File name Input File name
elev.default Float Float
ram Int Int
inxml XML input parameters file XML input parameters file
outxml XML output parameters file XML output parameters file

InputImage: Support image that will be classified.

InputMask: Validity mask (only pixels corresponding to a mask value greater than 0 will be used for statistics).

Input vectors: Input geometries to analyse.

Output Statistics: Output file to store statistics (XML format).

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

Layer Index: Layer index to read in the input vector file.

[Elevation management]: This group of parameters allows managing elevation values. Supported formats are SRTM, DTED or any geotiff. DownloadSRTMTiles application could be a useful tool to list/download tiles related to a product.

  • 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.
  • Geoid File: 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 (http://hg.orfeo-toolbox.org/OTB-Data/raw-file/404aa6e4b3e0/Input/DEM/egm96.grd).
  • Default elevation: 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): Available memory for processing (in MB).

Load otb application from xml file: Load otb application from xml file.

Save otb application to xml file: Save otb application to xml file.

Example

To run this example in command-line, use the following:

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

To run this example from Python, use the following code snippet:

#!/usr/bin/python

# Import the otb applications package
import otbApplication

# The following line creates an instance of the PolygonClassStatistics application
PolygonClassStatistics = otbApplication.Registry.CreateApplication("PolygonClassStatistics")

# The following lines set all the application parameters:
PolygonClassStatistics.SetParameterString("in", "support_image.tif")

PolygonClassStatistics.SetParameterString("vec", "variousVectors.sqlite")

# The following line execute the application
PolygonClassStatistics.ExecuteAndWriteOutput()

Limitations

None

Authors

This application has been written by OTB-Team.