ImageDev

DistanceMean2d

Gives the mean distance, edge to edge, between direct neighbor objects of a two-dimensional binary image.

Access to parameter description

For an introduction: section Image Analysis.
This algorithm calculates the distance map of the negative input image and then extracts the ridges separating the image objects.
The measured mean distance is computed as the average of twice the distance map values along this path.

See also

Function Syntax

This function returns the outputMeasurement output parameter.
// Function prototype.
DistanceMeanMsr::Ptr
distanceMean2d( std::shared_ptr< iolink::ImageView > inputBinaryImage, DistanceMeanMsr::Ptr outputMeasurement = NULL );
This function returns the outputMeasurement output parameter.
// Function prototype.
distance_mean_2d( input_binary_image, output_measurement = None )
This function returns the outputMeasurement output parameter.
// Function prototype.
public static DistanceMeanMsr
DistanceMean2d( IOLink.ImageView inputBinaryImage, DistanceMeanMsr outputMeasurement = null );

Class Syntax

Parameters

Class Name DistanceMean2d

Parameter Name Description Type Supported Values Default Value
input
inputBinaryImage
The input binary image. Image Binary nullptr
output
outputMeasurement
The output measurement result. DistanceMeanMsr nullptr

Object Examples

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

DistanceMean2d distanceMean2dAlgo;
distanceMean2dAlgo.setInputBinaryImage( polystyrene_sep );
distanceMean2dAlgo.execute();

std::cout << "distance: " << distanceMean2dAlgo.outputMeasurement()->distance( 0 ) ;
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip"))

distance_mean_2d_algo = imagedev.DistanceMean2d()
distance_mean_2d_algo.input_binary_image = polystyrene_sep
distance_mean_2d_algo.execute()

print( "distance: ", str( distance_mean_2d_algo.output_measurement.distance( 0 ) ) )
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" );

DistanceMean2d distanceMean2dAlgo = new DistanceMean2d
{
    inputBinaryImage = polystyrene_sep
};
distanceMean2dAlgo.Execute();

Console.WriteLine( "distance: " + distanceMean2dAlgo.outputMeasurement.distance( 0 ) );

Function Examples

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

auto result = distanceMean2d( polystyrene_sep );

std::cout << "distance: " << result->distance( 0 ) ;
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip"))

result = imagedev.distance_mean_2d( polystyrene_sep )

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

DistanceMeanMsr result = Processing.DistanceMean2d( polystyrene_sep );

Console.WriteLine(  "distance: " + result.distance( 0 )  );