SupervisedTextureClassification2d
Performs a segmentation of a two-dimensional grayscale image, based on a texture model automatically built from a training input image.
Access to parameter description
For an introduction:
See also
Access to parameter description
For an introduction:
- section Image Segmentation
- section Supervised Texture Classification
See also
Function Syntax
This function returns a SupervisedTextureClassification2dOutput structure containing the outputLabelImage and outputMapImage output parameters.
// Output structure. struct SupervisedTextureClassification2dOutput { std::shared_ptr< iolink::ImageView > outputLabelImage; std::shared_ptr< iolink::ImageView > outputMapImage; }; // Function prototype. SupervisedTextureClassification2dOutput supervisedTextureClassification2d( std::shared_ptr< iolink::ImageView > inputImage, std::shared_ptr< iolink::ImageView > inputTrainingImage, int32_t featureGroup, iolink::Vector2u32 radiusRange, uint32_t radiusStep, uint32_t coocRadius, SupervisedTextureClassification2d::CoocTextonShape coocTextonShape, uint32_t coocTextonSize, double minSeparationPercentage, SupervisedTextureClassification2d::OutputMapType outputMapType, std::shared_ptr< iolink::ImageView > outputLabelImage = NULL, std::shared_ptr< iolink::ImageView > outputMapImage = NULL );
Class Syntax
Parameters
Class Name | SupervisedTextureClassification2d |
---|
Parameter Name | Description | Type | Supported Values | Default Value | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
inputImage |
The input grayscale image to segment. | Image | Grayscale | nullptr | ||||||||||
![]() |
inputTrainingImage |
The input label training image (16 or 32 bits) where each label represents a class sample for the training step. | Image | Label | nullptr | ||||||||||
![]() |
featureGroup |
The groups of textural features to compute. This list defines all the textural attributes proposed for performing the classification.
|
MultipleChoice | DIRECTIONAL_COOCCURRENCE | ROTATION_INVARIANT_COOCCURRENCE | FIRST_ORDER_STATISTICS | HISTOGRAM_STATISTICS | INTENSITY | |||||||||||
![]() |
radiusRange |
The minimum and maximum radius, in pixels, of the circular neighborhoods used for computing textural features. | Vector2u32 | >=1 | {2, 14} | ||||||||||
![]() |
radiusStep |
The step in pixels used to define the set of radii between minimum and maximum. The maximum radius is systematically added to the radius list. | UInt32 | >=1 | 4 | ||||||||||
![]() |
coocRadius |
The radius, in pixels, of the circular neighborhood used by the co-occurrence features. This parameter is ignored if none of the co-occurrence feature groups is selected. | UInt32 | >=1 | 10 | ||||||||||
![]() |
coocTextonShape |
The shape of the co-occurrence texton (the pattern defined by the set of co-occurrence vectors). This parameter is ignored if none of the co-occurrence feature groups is selected.
The texton shape represents the distribution of points around the target point for computing the co-occurrence matrices. Associated to the texton size, it defines the set of vectors that are used for computing co-occurrence features. For instance, in 2D, a cube shape of size 3 defines the co-occurrence vectors (-3, -3), (0, -3), (3, -3), (-3, 0), (3, 0), (-3, 3), (0, 3) and (3, 3).
|
Enumeration | SPHERE | |||||||||||
![]() |
coocTextonSize |
The size, in pixels, of the texton shape for co-occurrence features. This parameter is ignored if none of the co-occurrence feature groups is selected.
This size is constrained by the radius parameter. The constraint depends on the texton shape. For instance, with a square texton, the texton size cannot exceed the rounded value of radius×√2. |
UInt32 | >=1 | 4 | ||||||||||
![]() |
minSeparationPercentage |
This parameter controls the rejection criteria of the feature selection algorithm (FS).
A measure is rejected if its contribution does not increase the separation power of the classification model enough. This ratio indicates the minimal relative growth required to keep a measure. More information is available in the Feature Selection section. This value must be greater than or equal to 0.0. |
Float64 | [0, 100] | 3 | ||||||||||
![]() |
outputMapType |
The type of uncertainty map image to compute.
|
Enumeration | CLOSEST_DISTANCE | |||||||||||
![]() |
outputLabelImage |
The output label image representing the texture classification result. Its dimensions and type are forced to the same values as the training input. | Image | nullptr | |||||||||||
![]() |
outputMapImage |
The output map image. Its dimensions are forced to the same values as the training image. In CLASS_DISTANCE mode, its number of channels is equal to the number of classes defined in the training image. Its data type is forced to floating point. | Image | nullptr |
Object Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto polystyrene_sep_label = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep_label.vip" ); SupervisedTextureClassification2d supervisedTextureClassification2dAlgo; supervisedTextureClassification2dAlgo.setInputImage( polystyrene ); supervisedTextureClassification2dAlgo.setInputTrainingImage( polystyrene_sep_label ); supervisedTextureClassification2dAlgo.setFeatureGroup( 4 ); supervisedTextureClassification2dAlgo.setRadiusRange( {2, 4} ); supervisedTextureClassification2dAlgo.setRadiusStep( 4 ); supervisedTextureClassification2dAlgo.setCoocRadius( 4 ); supervisedTextureClassification2dAlgo.setCoocTextonShape( SupervisedTextureClassification2d::CoocTextonShape::CUBE ); supervisedTextureClassification2dAlgo.setCoocTextonSize( 4 ); supervisedTextureClassification2dAlgo.setMinSeparationPercentage( 3 ); supervisedTextureClassification2dAlgo.setOutputMapType( SupervisedTextureClassification2d::OutputMapType::CLOSEST_DISTANCE ); supervisedTextureClassification2dAlgo.execute(); std::cout << "outputLabelImage:" << supervisedTextureClassification2dAlgo.outputLabelImage()->toString(); std::cout << "outputMapImage:" << supervisedTextureClassification2dAlgo.outputMapImage()->toString();
Function Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto polystyrene_sep_label = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep_label.vip" ); auto result = supervisedTextureClassification2d( polystyrene, polystyrene_sep_label, 4, {2, 4}, 4, 4, SupervisedTextureClassification2d::CoocTextonShape::CUBE, 4, 3, SupervisedTextureClassification2d::OutputMapType::CLOSEST_DISTANCE ); std::cout << "outputLabelImage:" << result.outputLabelImage->toString(); std::cout << "outputMapImage:" << result.outputMapImage->toString();