TextureClassificationApply
Classifies all pixels of an image using a trained texture model.
Access to parameter description
For an introduction:
The pixel is classified as belonging to the closest class and the corresponding label is assigned to it in the output label image.
The distances are stored in an uncertainty output image in accordance with a metric defined by the outputMapType parameter.
See also
Access to parameter description
For an introduction:
- section Image Segmentation
- section Supervised Texture Classification
The pixel is classified as belonging to the closest class and the corresponding label is assigned to it in the output label image.
The distances are stored in an uncertainty output image in accordance with a metric defined by the outputMapType parameter.
See also
Function Syntax
This function returns a TextureClassificationApplyOutput structure containing the outputLabelImage and outputMapImage output parameters.
// Output structure. struct TextureClassificationApplyOutput { std::shared_ptr< iolink::ImageView > outputLabelImage; std::shared_ptr< iolink::ImageView > outputMapImage; }; // Function prototype. TextureClassificationApplyOutput textureClassificationApply( std::shared_ptr< iolink::ImageView > inputImage, TextureClassificationModel::Ptr inputModel, TextureClassificationApply::OutputMapType outputMapType, std::shared_ptr< iolink::ImageView > outputLabelImage = NULL, std::shared_ptr< iolink::ImageView > outputMapImage = NULL );
This function returns a tuple containing the output_label_image and output_map_image output parameters.
// Function prototype. texture_classification_apply( input_image, input_model = None, output_map_type = TextureClassificationApply.OutputMapType.CLOSEST_DISTANCE, output_label_image = None, output_map_image = None )
This function returns a TextureClassificationApplyOutput structure containing the outputLabelImage and outputMapImage output parameters.
/// Output structure of the TextureClassificationApply function. public struct TextureClassificationApplyOutput { public IOLink.ImageView outputLabelImage; public IOLink.ImageView outputMapImage; }; // Function prototype. public static TextureClassificationApplyOutput TextureClassificationApply( IOLink.ImageView inputImage, TextureClassificationModel inputModel = null, TextureClassificationApply.OutputMapType outputMapType = ImageDev.TextureClassificationApply.OutputMapType.CLOSEST_DISTANCE, IOLink.ImageView outputLabelImage = null, IOLink.ImageView outputMapImage = null );
Class Syntax
Parameters
Class Name | TextureClassificationApply |
---|
Parameter Name | Description | Type | Supported Values | Default Value | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
inputImage |
The input grayscale image. | Image | Grayscale | nullptr | |||||||||
inputModel |
The input texture classification model, previously trained. | TextureClassificationModel | nullptr | ||||||||||
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
auto classification_input = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "classification_input.vip" ); TextureClassificationModel::Ptr modelToApply= TextureClassificationModel::read( std::string( IMAGEDEVDATA_OBJECTS_FOLDER ) + "modelToApply.vip" ); TextureClassificationApply textureClassificationApplyAlgo; textureClassificationApplyAlgo.setInputImage( classification_input ); textureClassificationApplyAlgo.setInputModel( modelToApply ); textureClassificationApplyAlgo.setOutputMapType( TextureClassificationApply::OutputMapType::CLOSEST_DISTANCE ); textureClassificationApplyAlgo.execute(); std::cout << "outputLabelImage:" << textureClassificationApplyAlgo.outputLabelImage()->toString(); std::cout << "outputMapImage:" << textureClassificationApplyAlgo.outputMapImage()->toString();
classification_input = imagedev.read_vip_image(imagedev_data.get_image_path("classification_input.vip")) model_to_apply = imagedev.TextureClassificationModel.read(imagedev_data.get_object_path("modelToApply.vip")) texture_classification_apply_algo = imagedev.TextureClassificationApply() texture_classification_apply_algo.input_image = classification_input texture_classification_apply_algo.input_model = model_to_apply texture_classification_apply_algo.output_map_type = imagedev.TextureClassificationApply.CLOSEST_DISTANCE texture_classification_apply_algo.execute() print( "output_label_image:", str( texture_classification_apply_algo.output_label_image ) ); print( "output_map_image:", str( texture_classification_apply_algo.output_map_image ) );
ImageView classification_input = Data.ReadVipImage( @"Data/images/classification_input.vip" ); TextureClassificationModel modelToApply = TextureClassificationModel.Read( @"Data/objects/modelToApply.vip" ); TextureClassificationApply textureClassificationApplyAlgo = new TextureClassificationApply { inputImage = classification_input, inputModel = modelToApply, outputMapType = TextureClassificationApply.OutputMapType.CLOSEST_DISTANCE }; textureClassificationApplyAlgo.Execute(); Console.WriteLine( "outputLabelImage:" + textureClassificationApplyAlgo.outputLabelImage.ToString() ); Console.WriteLine( "outputMapImage:" + textureClassificationApplyAlgo.outputMapImage.ToString() );
Function Examples
auto classification_input = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "classification_input.vip" ); TextureClassificationModel::Ptr modelToApply= TextureClassificationModel::read( std::string( IMAGEDEVDATA_OBJECTS_FOLDER ) + "modelToApply.vip" ); auto result = textureClassificationApply( classification_input, modelToApply, TextureClassificationApply::OutputMapType::CLOSEST_DISTANCE ); std::cout << "outputLabelImage:" << result.outputLabelImage->toString(); std::cout << "outputMapImage:" << result.outputMapImage->toString();
classification_input = imagedev.read_vip_image(imagedev_data.get_image_path("classification_input.vip")) model_to_apply = imagedev.TextureClassificationModel.read(imagedev_data.get_object_path("modelToApply.vip")) result_output_label_image, result_output_map_image = imagedev.texture_classification_apply( classification_input, model_to_apply, imagedev.TextureClassificationApply.CLOSEST_DISTANCE ) print( "output_label_image:", str( result_output_label_image ) ); print( "output_map_image:", str( result_output_map_image ) );
ImageView classification_input = Data.ReadVipImage( @"Data/images/classification_input.vip" ); TextureClassificationModel modelToApply = TextureClassificationModel.Read( @"Data/objects/modelToApply.vip" ); Processing.TextureClassificationApplyOutput result = Processing.TextureClassificationApply( classification_input, modelToApply, TextureClassificationApply.OutputMapType.CLOSEST_DISTANCE ); Console.WriteLine( "outputLabelImage:" + result.outputLabelImage.ToString() ); Console.WriteLine( "outputMapImage:" + result.outputMapImage.ToString() );