ImageDev

GeodesicDistanceMap

Computes a Chamfer distance map considering a mask of forbidden areas.

Access to parameter description

This algorithm computes a Chamfer distance map, like the DistanceMap2d and DistanceMap3d algorithms, but uses a mask to define some forbidden areas.
This algorithm is particularly useful when obstacles are present in the image and should not be taken into account in the distance map.

Use case: Measure of porosity distance.

<b> Figure 1.</b> Initial image
Figure 1. Initial image



Figure 2. Mask of the object (left) and mask of the material (right)



Figure 3. Distance map of the porosity displayed with a rainbow LUT
(taken the outside of object as the starting point of the distance map)


Note: This algorithm does not take into account the input image calibration. The output pixel values are systematically indicating distance in pixel units.

See also

Function Syntax

This function returns outputMapImage.
// Function prototype
std::shared_ptr< iolink::ImageView > geodesicDistanceMap( std::shared_ptr< iolink::ImageView > inputBinaryImage, std::shared_ptr< iolink::ImageView > inputMaskImage, std::shared_ptr< iolink::ImageView > outputMapImage = NULL );
This function returns outputMapImage.
// Function prototype.
geodesic_distance_map( input_binary_image, input_mask_image, output_map_image = None )
This function returns outputMapImage.
// Function prototype.
public static IOLink.ImageView
GeodesicDistanceMap( IOLink.ImageView inputBinaryImage,
                     IOLink.ImageView inputMaskImage,
                     IOLink.ImageView outputMapImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputBinaryImage
The binary input image. Image Binary nullptr
input
inputMaskImage
The binary image for the forbidden area. Distances are computed in regions having a 0 value in this image. It must have same dimensions and type as the input image. Image Binary nullptr
output
outputMapImage
The output distance map image. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. Image nullptr
Parameter Name Description Type Supported Values Default Value
input
input_binary_image
The binary input image. image Binary None
input
input_mask_image
The binary image for the forbidden area. Distances are computed in regions having a 0 value in this image. It must have same dimensions and type as the input image. image Binary None
output
output_map_image
The output distance map image. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. image None
Parameter Name Description Type Supported Values Default Value
input
inputBinaryImage
The binary input image. Image Binary null
input
inputMaskImage
The binary image for the forbidden area. Distances are computed in regions having a 0 value in this image. It must have same dimensions and type as the input image. Image Binary null
output
outputMapImage
The output distance map image. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. Image null

Object Examples

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

GeodesicDistanceMap geodesicDistanceMapAlgo;
geodesicDistanceMapAlgo.setInputBinaryImage( foam_sep );
geodesicDistanceMapAlgo.setInputMaskImage( foam_sep );
geodesicDistanceMapAlgo.execute();

std::cout << "outputMapImage:" << geodesicDistanceMapAlgo.outputMapImage()->toString();
foam_sep = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep.vip"))

geodesic_distance_map_algo = imagedev.GeodesicDistanceMap()
geodesic_distance_map_algo.input_binary_image = foam_sep
geodesic_distance_map_algo.input_mask_image = foam_sep
geodesic_distance_map_algo.execute()

print( "output_map_image:", str( geodesic_distance_map_algo.output_map_image ) )
ImageView foam_sep = Data.ReadVipImage( @"Data/images/foam_sep.vip" );

GeodesicDistanceMap geodesicDistanceMapAlgo = new GeodesicDistanceMap
{
    inputBinaryImage = foam_sep,
    inputMaskImage = foam_sep
};
geodesicDistanceMapAlgo.Execute();

Console.WriteLine( "outputMapImage:" + geodesicDistanceMapAlgo.outputMapImage.ToString() );

Function Examples

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

auto result = geodesicDistanceMap( foam_sep, foam_sep );

std::cout << "outputMapImage:" << result->toString();
foam_sep = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep.vip"))

result = imagedev.geodesic_distance_map( foam_sep, foam_sep )

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

IOLink.ImageView result = Processing.GeodesicDistanceMap( foam_sep, foam_sep );

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