4.8.7 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 4.126, page 722 presents a summary of these parameters and the parameters keys to be used in command-line and programming languages. Application key is PolygonClassStatistics.





Parameter key

Parameter type

Parameter description




in

Input image

InputImage

mask

Input image

InputMask

vec

Input File name

Input vectors

out

Output File name

Output Statistics

field

String

Field Name

layer

Int

Layer Index

ram

Int

Available RAM (Mb)

inxml

XML input parameters file

Load otb application from xml file

outxml

XML output parameters file

Save otb application to xml file











Table 4.126: Parameters table for Polygon Class Statistics.

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") 
 
PolygonClassStatistics.SetParameterString("field", "label") 
 
PolygonClassStatistics.SetParameterString("out", "polygonStat.xml") 
 
# The following line execute the application 
PolygonClassStatistics.ExecuteAndWriteOutput()

Limitations

None

Authors

This application has been written by OTB-Team.