ClosestBoundaryPoints2d
Computes the Chamfer distance map of the background of a two-dimensional image and the coordinates of the associated boundary points.
Access to parameter description
This algorithm is like the DistanceMap2d algorithm, applied on the background of the input image, and indicates the distance to the closest object boundary point.
It also stores the X and Y coordinates of the corresponding point in two additional output images.
Note: This algorithm does not take into account the input image calibration. The output values are systematically indicating distance in pixel units.
See also
Access to parameter description
This algorithm is like the DistanceMap2d algorithm, applied on the background of the input image, and indicates the distance to the closest object boundary point.
It also stores the X and Y coordinates of the corresponding point in two additional output images.
Note: This algorithm does not take into account the input image calibration. The output values are systematically indicating distance in pixel units.
See also
Function Syntax
This function returns a ClosestBoundaryPoints2dOutput structure containing outputMapImage, outputImageX and outputImageY.
// Output structure of the closestBoundaryPoints2d function. struct ClosestBoundaryPoints2dOutput { /// The output background distance map image. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. std::shared_ptr< iolink::ImageView > outputMapImage; /// The X coordinate image of the closest boundary point, in pixel units. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. std::shared_ptr< iolink::ImageView > outputImageX; /// The Y coordinate image of the closest boundary point, in pixel units. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. std::shared_ptr< iolink::ImageView > outputImageY; }; // Function prototype
ClosestBoundaryPoints2dOutput closestBoundaryPoints2d( std::shared_ptr< iolink::ImageView > inputBinaryImage, std::shared_ptr< iolink::ImageView > outputMapImage = nullptr, std::shared_ptr< iolink::ImageView > outputImageX = nullptr, std::shared_ptr< iolink::ImageView > outputImageY = nullptr );
This function returns a tuple containing output_map_image, output_image_x and output_image_y.
// Function prototype. closest_boundary_points_2d(input_binary_image: idt.ImageType, output_map_image: idt.ImageType = None, output_image_x: idt.ImageType = None, output_image_y: idt.ImageType = None) -> Tuple[idt.ImageType, idt.ImageType, idt.ImageType]
This function returns a ClosestBoundaryPoints2dOutput structure containing outputMapImage, outputImageX and outputImageY.
/// Output structure of the ClosestBoundaryPoints2d function. public struct ClosestBoundaryPoints2dOutput { /// /// The output background distance map image. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. /// public IOLink.ImageView outputMapImage; /// /// The X coordinate image of the closest boundary point, in pixel units. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. /// public IOLink.ImageView outputImageX; /// /// The Y coordinate image of the closest boundary point, in pixel units. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. /// public IOLink.ImageView outputImageY; }; // Function prototype. public static ClosestBoundaryPoints2dOutput ClosestBoundaryPoints2d( IOLink.ImageView inputBinaryImage, IOLink.ImageView outputMapImage = null, IOLink.ImageView outputImageX = null, IOLink.ImageView outputImageY = null );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
inputBinaryImage |
The binary input image. | Image | Binary | nullptr | |
outputMapImage |
The output background distance map image. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. | Image | nullptr | ||
outputImageX |
The X coordinate image of the closest boundary point, in pixel units. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. | Image | nullptr | ||
outputImageY |
The Y coordinate image of the closest boundary point, in pixel units. 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_binary_image |
The binary input image. | image | Binary | None | |
output_map_image |
The output background distance map image. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. | image | None | ||
output_image_x |
The X coordinate image of the closest boundary point, in pixel units. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. | image | None | ||
output_image_y |
The Y coordinate image of the closest boundary point, in pixel units. 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 | |
---|---|---|---|---|---|
inputBinaryImage |
The binary input image. | Image | Binary | null | |
outputMapImage |
The output background distance map image. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. | Image | null | ||
outputImageX |
The X coordinate image of the closest boundary point, in pixel units. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. | Image | null | ||
outputImageY |
The Y coordinate image of the closest boundary point, in pixel units. Its dimensions are forced to the same values as the input. Its type is signed 16-bit integer. | Image | null |
Object Examples
auto polystyrene_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep.vip" ); ClosestBoundaryPoints2d closestBoundaryPoints2dAlgo; closestBoundaryPoints2dAlgo.setInputBinaryImage( polystyrene_sep ); closestBoundaryPoints2dAlgo.execute(); std::cout << "outputMapImage:" << closestBoundaryPoints2dAlgo.outputMapImage()->toString(); std::cout << "outputImageX:" << closestBoundaryPoints2dAlgo.outputImageX()->toString(); std::cout << "outputImageY:" << closestBoundaryPoints2dAlgo.outputImageY()->toString();
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip")) closest_boundary_points_2d_algo = imagedev.ClosestBoundaryPoints2d() closest_boundary_points_2d_algo.input_binary_image = polystyrene_sep closest_boundary_points_2d_algo.execute() print("output_map_image:", str(closest_boundary_points_2d_algo.output_map_image)) print("output_image_x:", str(closest_boundary_points_2d_algo.output_image_x)) print("output_image_y:", str(closest_boundary_points_2d_algo.output_image_y))
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" ); ClosestBoundaryPoints2d closestBoundaryPoints2dAlgo = new ClosestBoundaryPoints2d { inputBinaryImage = polystyrene_sep }; closestBoundaryPoints2dAlgo.Execute(); Console.WriteLine( "outputMapImage:" + closestBoundaryPoints2dAlgo.outputMapImage.ToString() ); Console.WriteLine( "outputImageX:" + closestBoundaryPoints2dAlgo.outputImageX.ToString() ); Console.WriteLine( "outputImageY:" + closestBoundaryPoints2dAlgo.outputImageY.ToString() );
Function Examples
auto polystyrene_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep.vip" ); auto result = closestBoundaryPoints2d( polystyrene_sep ); std::cout << "outputMapImage:" << result.outputMapImage->toString(); std::cout << "outputImageX:" << result.outputImageX->toString(); std::cout << "outputImageY:" << result.outputImageY->toString();
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip")) result_output_map_image, result_output_image_x, result_output_image_y = imagedev.closest_boundary_points_2d(polystyrene_sep) print("output_map_image:", str(result_output_map_image)) print("output_image_x:", str(result_output_image_x)) print("output_image_y:", str(result_output_image_y))
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" ); Processing.ClosestBoundaryPoints2dOutput result = Processing.ClosestBoundaryPoints2d( polystyrene_sep ); Console.WriteLine( "outputMapImage:" + result.outputMapImage.ToString() ); Console.WriteLine( "outputImageX:" + result.outputImageX.ToString() ); Console.WriteLine( "outputImageY:" + result.outputImageY.ToString() );