ImageDev

TextureClassificationCreate

Creates a new object model for performing a texture classification.

Access to parameter description

As an introduction: TextureClassificationCreate intializes a texture classification model that contains: After being created, a model must be trained with the TextureClassificationTrain algorithm before being used with the TextureClassificationApply algorithm.

See also

Function Syntax

This function returns outputModel.
// Function prototype
TextureClassificationModel::Ptr textureClassificationCreate( TextureClassificationCreate::ComputeMode computeMode, uint32_t numberOfClasses, int32_t featureGroup, iolink::Vector2u32 radiusRange, uint32_t radiusStep, uint32_t coocRadius, TextureClassificationCreate::CoocTextonShape coocTextonShape, uint32_t coocTextonSize, TextureClassificationModel::Ptr outputModel = NULL );
This function returns outputModel.
// Function prototype.
texture_classification_create( compute_mode = TextureClassificationCreate.ComputeMode.MODE_2D,
                               number_of_classes = 2,
                               feature_group = 31,
                               radius_range = [2, 14],
                               radius_step = 4,
                               cooc_radius = 10,
                               cooc_texton_shape = TextureClassificationCreate.CoocTextonShape.SPHERE,
                               cooc_texton_size = 4,
                               output_model = None )
This function returns outputModel.
// Function prototype.
public static TextureClassificationModel
TextureClassificationCreate( TextureClassificationCreate.ComputeMode computeMode = ImageDev.TextureClassificationCreate.ComputeMode.MODE_2D,
                             UInt32 numberOfClasses = 2,
                             Int32 featureGroup = 31,
                             uint[] radiusRange = null,
                             UInt32 radiusStep = 4,
                             UInt32 coocRadius = 10,
                             TextureClassificationCreate.CoocTextonShape coocTextonShape = ImageDev.TextureClassificationCreate.CoocTextonShape.SPHERE,
                             UInt32 coocTextonSize = 4,
                             TextureClassificationModel outputModel = null );

Class Syntax

Parameters

Class Name TextureClassificationCreate

Parameter Name Description Type Supported Values Default Value
input
computeMode
The computation mode: 2D or 3D.
MODE_2D Computation as 2D data.
MODE_3D Computation as 3D data.
Enumeration MODE_2D
input
numberOfClasses
The number of classes to discriminate. UInt32 >=2 2
input
featureGroup
The groups of textural features to compute. This list defines all the textural attributes proposed for performing the classification.
DIRECTIONAL_COOCCURRENCE Features based on co-occurrence matrices. One feature is extracted from each co-occurrence vector. Associated value = 1.
ROTATION_INVARIANT_COOCCURRENCE Features based on co-occurrence matrices. Three statistical features are extracted from all vectors. Associated value = 2.
FIRST_ORDER_STATISTICS Features based on first order statistics that are not computed using a histogram. Associated value = 4.
HISTOGRAM_STATISTICS Features based on histogram statistics, including histogram quantiles. Associated value = 8.
INTENSITY Feature based on the intensity value of the input image. Associated value = 16.
MultipleChoice DIRECTIONAL_COOCCURRENCE | ROTATION_INVARIANT_COOCCURRENCE | FIRST_ORDER_STATISTICS | HISTOGRAM_STATISTICS | INTENSITY
input
radiusRange
The minimum and maximum radius, in pixels, of the circular neighborhoods used for computing textural features. Vector2u32 >=1 {2, 14}
input
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
input
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
input
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).
CUBE The set of all points associated to corners and edge centers of a square with a half side size defined by the coocTextonSize parameter.
SPHERE The set of all points located at the same euclidean distance defined by the coocTextonSize parameter from the center. This mode is recommended when a repetitive texture is mono-scale.
BALL The set of all points located at a distance less or equal to the coocTextonSize parameter from the center. This mode can be useful to classify a multi-scale repetitive texture, but may be very time consuming.
Enumeration SPHERE
input
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 \times \sqrt{2}$.
UInt32 >=1 4
output
outputModel
The output texture classification model, newly created. TextureClassificationModel nullptr

Object Examples


TextureClassificationCreate textureClassificationCreateAlgo;
textureClassificationCreateAlgo.setComputeMode( TextureClassificationCreate::ComputeMode::MODE_2D );
textureClassificationCreateAlgo.setNumberOfClasses( 2 );
textureClassificationCreateAlgo.setFeatureGroup( 4 );
textureClassificationCreateAlgo.setRadiusRange( {15, 15} );
textureClassificationCreateAlgo.setRadiusStep( 1 );
textureClassificationCreateAlgo.setCoocRadius( 15 );
textureClassificationCreateAlgo.setCoocTextonShape( TextureClassificationCreate::CoocTextonShape::SPHERE );
textureClassificationCreateAlgo.setCoocTextonSize( 5 );
textureClassificationCreateAlgo.execute();

std::cout << "computeMode: " << textureClassificationCreateAlgo.outputModel()->computeMode( ) ;

texture_classification_create_algo = imagedev.TextureClassificationCreate()
texture_classification_create_algo.compute_mode = imagedev.TextureClassificationCreate.MODE_2D
texture_classification_create_algo.number_of_classes = 2
texture_classification_create_algo.feature_group = 4
texture_classification_create_algo.radius_range = [15, 15]
texture_classification_create_algo.radius_step = 1
texture_classification_create_algo.cooc_radius = 15
texture_classification_create_algo.cooc_texton_shape = imagedev.TextureClassificationCreate.SPHERE
texture_classification_create_algo.cooc_texton_size = 5
texture_classification_create_algo.execute()

print( "computeMode: ", str( texture_classification_create_algo.output_model.compute_mode( ) ) )

TextureClassificationCreate textureClassificationCreateAlgo = new TextureClassificationCreate
{
    computeMode = TextureClassificationCreate.ComputeMode.MODE_2D,
    numberOfClasses = 2,
    featureGroup = 4,
    radiusRange = new uint[]{15, 15},
    radiusStep = 1,
    coocRadius = 15,
    coocTextonShape = TextureClassificationCreate.CoocTextonShape.SPHERE,
    coocTextonSize = 5
};
textureClassificationCreateAlgo.Execute();

Console.WriteLine( "computeMode: " + textureClassificationCreateAlgo.outputModel.computeMode( ) );

Function Examples


auto result = textureClassificationCreate( TextureClassificationCreate::ComputeMode::MODE_2D, 2, 4, {15, 15}, 1, 15, TextureClassificationCreate::CoocTextonShape::SPHERE, 5 );

std::cout << "computeMode: " << result->computeMode( ) ;

result = imagedev.texture_classification_create( imagedev.TextureClassificationCreate.MODE_2D, 2, 4, [15, 15], 1, 15, imagedev.TextureClassificationCreate.SPHERE, 5 )

print( "computeMode: ", str( result.compute_mode( ) )  )

TextureClassificationModel result = Processing.TextureClassificationCreate( TextureClassificationCreate.ComputeMode.MODE_2D, 2, 4, new uint[]{15, 15}, 1, 15, TextureClassificationCreate.CoocTextonShape.SPHERE, 5 );

Console.WriteLine(  "computeMode: " + result.computeMode( )  );