SampleExtraction

Extracts samples values from an image.

Description

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

Parameters

InputImage -in image Mandatory
Support image

Input sampling positions -vec vectorfile Mandatory
Vector data file containing samplingpositions. (OGR format)

Output samples -out filename [dtype]
Output vector data file storing samplevalues (OGR format). If not given, the input vector data file is updated

Output field names -outfield [prefix|list] Default value: prefix
Choice between naming method for output fields

  • Use a prefix and an incremental counter
    Use a prefix and an incremental counter
  • Use the given name list
    Use the given name list

Use a prefix and an incremental counter options

Output field prefix -outfield.prefix.name string Default value: value_
Prefix used to form the field names thatwill contain the extracted values.

Use the given name list options

Output field names -outfield.list.names string1 string2... Mandatory
Full list of output field names.


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.

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

Examples

From the command-line:

otbcli_SampleExtraction -in support_image.tif -vec sample_positions.sqlite -outfield prefix -outfield.prefix.name band_ -field label -out sample_values.sqlite

From Python:

import otbApplication

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

app.SetParameterString("in", "support_image.tif")
app.SetParameterString("vec", "sample_positions.sqlite")
app.SetParameterString("outfield","prefix")
app.SetParameterString("outfield.prefix.name", "band_")
app.SetParameterString("field", "label")
app.SetParameterString("out", "sample_values.sqlite")

app.ExecuteAndWriteOutput()