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 = nullptr );
This function returns outputLabelImage.
// Function prototype.
group_close_labelsl_2d(input_object_image: idt.ImageType,
                       max_distance: float = 3,
                       output_label_image: idt.ImageType = None) -> idt.ImageType
This function returns outputLabelImage.
// Function prototype.
public static IOLink.ImageView
GroupCloseLabelsl2d( IOLink.ImageView inputObjectImage,
                     double maxDistance = 3,
                     IOLink.ImageView outputLabelImage = null );

Class Syntax

Parameters

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
Parameter Name Description Type Supported Values Default Value
input
input_object_image
The input binary or label image. image Binary or Label None
input
max_distance
The maximum distance beteween two objects for grouping them. float64 >0 3
output
output_label_image
The output label image. Its dimensions are forced to the same values as the input. image None
Parameter Name Description Type Supported Values Default Value
input
inputObjectImage
The input binary or label image. Image Binary or Label null
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 null

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();
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip"))

group_close_labelsl_2d_algo = imagedev.GroupCloseLabelsl2d()
group_close_labelsl_2d_algo.input_object_image = polystyrene_sep
group_close_labelsl_2d_algo.max_distance = 3.0
group_close_labelsl_2d_algo.execute()

print("output_label_image:", str(group_close_labelsl_2d_algo.output_label_image))
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" );

GroupCloseLabelsl2d groupCloseLabelsl2dAlgo = new GroupCloseLabelsl2d
{
    inputObjectImage = polystyrene_sep,
    maxDistance = 3.0
};
groupCloseLabelsl2dAlgo.Execute();

Console.WriteLine( "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();
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip"))

result = imagedev.group_close_labelsl_2d(polystyrene_sep, 3.0)

print("output_label_image:", str(result))
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" );

IOLink.ImageView result = Processing.GroupCloseLabelsl2d( polystyrene_sep, 3.0 );

Console.WriteLine( "outputLabelImage:" + result.ToString() );