4.8.10 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 4.132, page 734 presents a summary of these parameters and the parameters keys to be used in command-line and programming languages. Application key is SampleExtraction.





Parameter key

Parameter type

Parameter description




in

Input image

InputImage

vec

Input File name

Input sampling positions

out

Output File name

Output samples

outfield

Choices

Output field names

outfield prefix

Choice

Use a prefix and an incremental counter

outfield list

Choice

Use the given name list

outfield.prefix.name

String

Output field prefix

outfield.list.names

String list

Output field names

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.132: Parameters table for Sample Extraction.

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:

Field Name Name of the field carrying the classname in the input vectors. This field is copied to output.

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_") 
 
SampleExtraction.SetParameterString("field", "label") 
 
SampleExtraction.SetParameterString("out", "sample_values.sqlite") 
 
# The following line execute the application 
SampleExtraction.ExecuteAndWriteOutput()

Limitations

None

Authors

This application has been written by OTB-Team.