ImageDev

GroupCloseLabelsl2d

Assigns a same label to objects that are closed to each other.

Access to parameter description

Given a grouping distance, objects are assigned to a same label if their boundaries are separated by this distance or less.

<b> (a) </b>
(a)
<b> (b) </b>
(b)
<b> (c) </b>
(c)
Figure 1. Particle grouping: (a) binary image of particles,@Br (b) label image with a different label for each particle, (c) grouped label image with a same label for each cluster of particles

The figure above compares the results of the classical connected component and cluster based labeling algorithms on a binary image representing some particles. On the example above, the chosen distance is 20 pixels, therefore particles separated by 20 pixels or less are recognized as belonging to a same cluster and are set to the same label.

See also

Function Syntax

This function returns outputLabelImage.
// Function prototype
std::shared_ptr< iolink::ImageView > groupCloseLabelsl2d( std::shared_ptr< iolink::ImageView > inputObjectImage, double maxDistance, std::shared_ptr< iolink::ImageView > outputLabelImage = NULL );

Class Syntax

Parameters

Class Name GroupCloseLabelsl2d

Parameter Name Description Type Supported Values Default Value
input
inputObjectImage
The input binary or label image. Image Binary or Label nullptr
input
maxDistance
The maximum distance beteween two objects for grouping them. Float64 >0 3
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" );

GroupCloseLabelsl2d groupCloseLabelsl2dAlgo;
groupCloseLabelsl2dAlgo.setInputObjectImage( polystyrene_sep );
groupCloseLabelsl2dAlgo.setMaxDistance( 3.0 );
groupCloseLabelsl2dAlgo.execute();

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

Function Examples

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

auto result = groupCloseLabelsl2d( polystyrene_sep, 3.0 );

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