AddObjectToLabel
Inserts a marker to a label image with a specific value.
Access to parameter description
This algorithm inserts a marker, described in a binary image, to a label image.
The result is a copy of the label image covered by the marker.
The pixels belonging to the marker are set to the value defined by the labelValue parameter.
A label image may be 8, 16 or 32 bits per pixel. By default the result of this algorithm is a 16-bit label image, but if the number of labels exceeds 65,535 then the output image is automatically converted to 32-bit type, and thus can manage more than two billion labels.
Figure 1. (a) Binary image describing the marker to add,@Br
(b) label image in which the marker is inserted, (c) result image with added marker
See also
Access to parameter description
This algorithm inserts a marker, described in a binary image, to a label image.
The result is a copy of the label image covered by the marker.
The pixels belonging to the marker are set to the value defined by the labelValue parameter.
A label image may be 8, 16 or 32 bits per pixel. By default the result of this algorithm is a 16-bit label image, but if the number of labels exceeds 65,535 then the output image is automatically converted to 32-bit type, and thus can manage more than two billion labels.
(a) |
(b) |
(c) |
See also
Function Syntax
This function returns the outputLabelImage output parameter.
// Function prototype. std::shared_ptr< iolink::ImageView > addObjectToLabel( std::shared_ptr< iolink::ImageView > inputBinaryImage, std::shared_ptr< iolink::ImageView > inputLabelImage, int32_t labelValue, std::shared_ptr< iolink::ImageView > outputLabelImage = NULL );
This function returns the outputLabelImage output parameter.
// Function prototype. add_object_to_label( input_binary_image, input_label_image, label_value = 1, output_label_image = None )
This function returns the outputLabelImage output parameter.
// Function prototype. public static IOLink.ImageView AddObjectToLabel( IOLink.ImageView inputBinaryImage, IOLink.ImageView inputLabelImage, Int32 labelValue = 1, IOLink.ImageView outputLabelImage = null );
Class Syntax
Parameters
Class Name | AddObjectToLabel |
---|
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
inputBinaryImage |
The input binary image. | Image | Binary | nullptr | |
inputLabelImage |
The input label image. It must have same dimensions as the binary input image. | Image | Label | nullptr | |
labelValue |
The label value to assign. | Int32 | >=1 | 1 | |
outputLabelImage |
The output label image. Its dimensions are forced to the same values as the input. | Image | nullptr |
Object Examples
auto foam_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam_sep.vip" ); auto foam_sep_label = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam_sep_label.vip" ); AddObjectToLabel addObjectToLabelAlgo; addObjectToLabelAlgo.setInputBinaryImage( foam_sep ); addObjectToLabelAlgo.setInputLabelImage( foam_sep_label ); addObjectToLabelAlgo.setLabelValue( 1 ); addObjectToLabelAlgo.execute(); std::cout << "outputLabelImage:" << addObjectToLabelAlgo.outputLabelImage()->toString();
foam_sep = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep.vip")) foam_sep_label = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep_label.vip")) add_object_to_label_algo = imagedev.AddObjectToLabel() add_object_to_label_algo.input_binary_image = foam_sep add_object_to_label_algo.input_label_image = foam_sep_label add_object_to_label_algo.label_value = 1 add_object_to_label_algo.execute() print( "output_label_image:", str( add_object_to_label_algo.output_label_image ) );
ImageView foam_sep = Data.ReadVipImage( @"Data/images/foam_sep.vip" ); ImageView foam_sep_label = Data.ReadVipImage( @"Data/images/foam_sep_label.vip" ); AddObjectToLabel addObjectToLabelAlgo = new AddObjectToLabel { inputBinaryImage = foam_sep, inputLabelImage = foam_sep_label, labelValue = 1 }; addObjectToLabelAlgo.Execute(); Console.WriteLine( "outputLabelImage:" + addObjectToLabelAlgo.outputLabelImage.ToString() );
Function Examples
auto foam_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam_sep.vip" ); auto foam_sep_label = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam_sep_label.vip" ); auto result = addObjectToLabel( foam_sep, foam_sep_label, 1 ); std::cout << "outputLabelImage:" << result->toString();
foam_sep = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep.vip")) foam_sep_label = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep_label.vip")) result = imagedev.add_object_to_label( foam_sep, foam_sep_label, 1 ) print( "output_label_image:", str( result ) );
ImageView foam_sep = Data.ReadVipImage( @"Data/images/foam_sep.vip" ); ImageView foam_sep_label = Data.ReadVipImage( @"Data/images/foam_sep_label.vip" ); IOLink.ImageView result = Processing.AddObjectToLabel( foam_sep, foam_sep_label, 1 ); Console.WriteLine( "outputLabelImage:" + result.ToString() );