Implements new applications for large scale connected components segmentation.
The existing connected component application performs the following steps :
Compute a label image (raster mono-band image with integer pixel values) from a multi-band image, a same label is assigned to "connected" pixels. Two pixels are said to be connected if the MuParser expression given as an input returns true (for example "distance<5"). The input image is therefore segmented in group of connected pixels. Additionally, a mask expression (also using MuParser) can be given to mask some pixels.
The label image is converted to an ITK label map (see http://www.insight-journal.org/browse/publication/176).
Geometric and radiometric attributes are computed using the label map and the input image (size, perimeter, mean, variance, kurtosis etc)
An OBIA expression (MuParser) is used to filter some objects of the label map, for example filter objects that verify "size<15"
The LabelMap is then vectorized.
If connected component is used inside the large scale segmentation framework, some connected components that may have been splitted during vectorization will be merged.
There are two main problems with this application :
It does too many things, for example an user may want to only perform the vectorization of a label image (this is the original goal of the mask filtering application described at the beginning of this issue).
It doesn't work well with threading. Filtering (4) is done before fusion of segments (6), and the features are therefore computed on splitted segments.
We propose a different workflow for connected components, with the following steps :
Compute the label image (same as 1. )
Vectorize the label image, and merge the splitted segments
Compute the geometric features from the vector data (size and perimeter)
Filter the vector data using the computed geometric features and radiometric features.
Each of these steps is performed in a different application. This workflow does not use ITK's Label Maps, instead we use the persistent filters from the segmentation framework to perform vectorization (abstract filter PersistentImageToOGRLayerFilter), and the persistent filters from the sampling framework (abstract filter PersistentSamplingFilterBase).
Classes and files
New persistent filter
PersistentLabelImageVectorizationFilterand the associated decorator
LabelImageVectorizationFilterin files otbPersistentLabelImageVectorizationFilter.h/hxx.
ConnectedComponentStreamStitchingFilterin files otbConnectedComponentStreamStitchingFilter.h/hxx
OGRDataToPolygonGeometricFeaturesFilterin files otbOGRDataToPolygonGeometricFeaturesFilter.h/hxx
There is one new application for each step described above :
There is also a composite application chaining all these applications :
validation tests have been created for the application
The copyright owner is CNES and has signed the ORFEO ToolBox Contributor License Agreement.