ImageDev

AssignLabel

Converts a binary image into a label image by changing its intensity values to a specific value.

Access to parameter description

This algorithm is used to assign a user-defined label value to a binary image.

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.

See also

Function Syntax

This function returns outputLabelImage.
// Function prototype
std::shared_ptr< iolink::ImageView > assignLabel( std::shared_ptr< iolink::ImageView > inputBinaryImage, int32_t labelValue, std::shared_ptr< iolink::ImageView > outputLabelImage = NULL );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputBinaryImage
The input binary image. Image Binary nullptr
input
labelValue
The label value to assign. Int32 >=1 1
output
outputLabelImage
The output label image. Its dimensions are forced to the same values as the input. Image nullptr

Object Examples

auto polystyrene_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep.vip" );

AssignLabel assignLabelAlgo;
assignLabelAlgo.setInputBinaryImage( polystyrene_sep );
assignLabelAlgo.setLabelValue( 1 );
assignLabelAlgo.execute();

std::cout << "outputLabelImage:" << assignLabelAlgo.outputLabelImage()->toString();

Function Examples

auto polystyrene_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep.vip" );

auto result = assignLabel( polystyrene_sep, 1 );

std::cout << "outputLabelImage:" << result->toString();