Request for Changes-46: Sample extractor

From OTBWiki
Jump to: navigation, search

[Request for Changes - 46] Sample extractor



This RFC is the next step after Request_for_Changes-36:_Samples_selection_filter. It contains filters and application to extract sample values for a set of input sample positions given as OGR data file.


See request for comments #20 : [1]

Implementation details

Classes and files

A       Modules/Learning/Sampling/include/otbImageSampleExtractorFilter.h
A       Modules/Learning/Sampling/include/otbImageSampleExtractorFilter.txx
M       Modules/Learning/Sampling/include/otbOGRDataToSamplePositionFilter.txx
M       Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.h
M       Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.txx
M       Modules/Learning/Sampling/otb-module.cmake
M       Modules/Segmentation/Conversion/include/otbPersistentImageToOGRDataFilter.h
M       Modules/Segmentation/Conversion/include/otbPersistentImageToOGRDataFilter.txx

In a nutshell :

  • The base class otb::PersistentSamplingFilterBase has been enhanced to better support update mode.
  • The new class otb::ImageSampleExtractor does the extraction job. It derives from PersistentSamplingFilterBase so streaming and threading are already implemented. If the input and output OGRDataSource are the same, the filter works in 'update' mode.
  • The handling of additional fields has been fixed in PersistentSamplingFilterBase, ImageSampleExtractor and OGRDataToSamplePositionFilter.
  • The API of otb::PersistentImageToOGRDataFilter has been enhanced. It was chosen as a base class for the first implementation but now, there is no filter in OTB using this class. This class now allows to set the geometry type of the output layer, and the field type.


M       Modules/Applications/AppClassification/app/CMakeLists.txt
A       Modules/Applications/AppClassification/app/otbSampleExtraction.cxx

The application SampleExtraction exposes the filter ImageSampleExtractor. The application has few parameters, the inputs are the support image and the sample positions. If no output OGR data file is given, the update mode is used. All sample values are stored as fields (1 for each band). The fields names has the same prefix, for instance : "value_0", "value_1", "value_2" ...


M       Modules/Applications/AppClassification/test/CMakeLists.txt
M       Modules/Learning/Sampling/test/CMakeLists.txt
A       Modules/Learning/Sampling/test/otbImageSampleExtractorFilterTest.cxx
M       Modules/Learning/Sampling/test/otbSamplingTestDriver.cxx

There are tests for both 'copy' and 'update' mode.


There will be dedicated CookBook section.

Additional notes

List remaining open issues if any, and additional notes.