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 );
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();
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();