Sample Extraction

Extracts samples values from an image.

Detailed description

The application extracts samples values from animage using positions contained in a vector data file.

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 SampleExtraction .

[1]Table: Parameters table for Sample Extraction.
Parameter Key Parameter Type Parameter Description
in Input image Input image
vec Input File name Input File name
out Output File name Output File name
outfield Choices Choices
outfield prefix Choice Use a prefix and an incremental counter
outfield list Choice Use the given name list
outfield.prefix.name String String
outfield.list.names String list String list
field List List
layer Int Int
ram Int Int
inxml XML input parameters file XML input parameters file
outxml XML output parameters file XML output parameters file

InputImage: Support image.

Input sampling positions: Vector data file containing samplingpositions. (OGR format).

Output samples: Output vector data file storing samplevalues (OGR format). If not given, the input vector data file is updated.

Output field names: Choice between naming method for output fields. Available choices are:

  • Use a prefix and an incremental counter: Use a prefix and an incremental counter.
  • Output field prefix: Prefix used to form the field names thatwill contain the extracted values.
  • Use the given name list: Use the given name list.
  • Output field names: Full list of output field names.

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.

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_SampleExtraction -in support_image.tif -vec sample_positions.sqlite -outfield prefix -outfield.prefix.name band_ -field label -out sample_values.sqlite

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 SampleExtraction application
SampleExtraction = otbApplication.Registry.CreateApplication("SampleExtraction")

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

SampleExtraction.SetParameterString("vec", "sample_positions.sqlite")

SampleExtraction.SetParameterString("outfield","prefix")

SampleExtraction.SetParameterString("outfield.prefix.name", "band_")

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

Limitations

None

Authors

This application has been written by OTB-Team.