ImageDev

ErosionLine2d

Performs a two-dimensional erosion using a structuring element matching with a line.

Access to parameter description

For an introduction: A linear erosion controls the direction of the erosion, therefore making it possible to shrink and remove objects along the erosion path.
The erosion is performed by using a linear structuring element. The direction of 0 degrees is horizontal and to the left, and the angles are calculated counter-clockwise.

<b> Figure 1.</b>  Linear structuring element and eroded image
Figure 1. Linear structuring element and eroded image


<b> Figure 2.</b> Two gray level erosions: by a square (top) and a linear structuring element (bottom)
Figure 2. Two gray level erosions: by a square (top) and a linear structuring element (bottom)

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > erosionLine2d( std::shared_ptr< iolink::ImageView > inputImage, double orientationAngle, uint32_t kernelRadius, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype.
erosion_line_2d(input_image: idt.ImageType,
                orientation_angle: float = 10,
                kernel_radius: int = 3,
                output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
ErosionLine2d( IOLink.ImageView inputImage,
               double orientationAngle = 10,
               UInt32 kernelRadius = 3,
               IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. The image type can be integer or float. Image Binary, Label, Grayscale or Multispectral nullptr
input
orientationAngle
The angle of orientation in degrees. Float64 Any value 10
input
kernelRadius
The length of the linear structuring element in pixels. UInt32 >=1 3
output
outputImage
The output image. Its dimensions and type are forced to the same values as the input image. Image nullptr
Parameter Name Description Type Supported Values Default Value
input
input_image
The input image. The image type can be integer or float. image Binary, Label, Grayscale or Multispectral None
input
orientation_angle
The angle of orientation in degrees. float64 Any value 10
input
kernel_radius
The length of the linear structuring element in pixels. uint32 >=1 3
output
output_image
The output image. Its dimensions and type are forced to the same values as the input image. image None
Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. The image type can be integer or float. Image Binary, Label, Grayscale or Multispectral null
input
orientationAngle
The angle of orientation in degrees. Float64 Any value 10
input
kernelRadius
The length of the linear structuring element in pixels. UInt32 >=1 3
output
outputImage
The output image. Its dimensions and type are forced to the same values as the input image. Image null

Object Examples

auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

ErosionLine2d erosionLine2dAlgo;
erosionLine2dAlgo.setInputImage( polystyrene );
erosionLine2dAlgo.setOrientationAngle( 10 );
erosionLine2dAlgo.setKernelRadius( 3 );
erosionLine2dAlgo.execute();

std::cout << "outputImage:" << erosionLine2dAlgo.outputImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

erosion_line_2d_algo = imagedev.ErosionLine2d()
erosion_line_2d_algo.input_image = polystyrene
erosion_line_2d_algo.orientation_angle = 10
erosion_line_2d_algo.kernel_radius = 3
erosion_line_2d_algo.execute()

print("output_image:", str(erosion_line_2d_algo.output_image))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

ErosionLine2d erosionLine2dAlgo = new ErosionLine2d
{
    inputImage = polystyrene,
    orientationAngle = 10,
    kernelRadius = 3
};
erosionLine2dAlgo.Execute();

Console.WriteLine( "outputImage:" + erosionLine2dAlgo.outputImage.ToString() );

Function Examples

auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

auto result = erosionLine2d( polystyrene, 10, 3 );

std::cout << "outputImage:" << result->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

result = imagedev.erosion_line_2d(polystyrene, 10, 3)

print("output_image:", str(result))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

IOLink.ImageView result = Processing.ErosionLine2d( polystyrene, 10, 3 );

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