Extracts samples values from an image.


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


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


From the command-line:

otbcli_SampleExtraction -in support_image.tif -vec sample_positions.sqlite -outfield prefix 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("", "band_")
app.SetParameterString("field", "label")
app.SetParameterString("out", "sample_values.sqlite")