ImageDev

ErosionColor2d

Performs an erosion on a true-color image using a structuring element matching with a square.

Access to parameter description

For an introduction: This algorithm performs an erosion on a true-color image, composed of 3 channels: red, green and blue.
The minimum in the neighborhood is either computed on the luminance or the saturation of pixels, and the center is set to the pixel that gives the minimum luminance or saturation.
With this method, no new color is created.

See also

Function Syntax

This function returns the outputColorImage output parameter.
// Function prototype.
std::shared_ptr< iolink::ImageView >
erosionColor2d( std::shared_ptr< iolink::ImageView > inputColorImage,
                int32_t kernelRadius,
                ErosionColor2d::CriterionPlane criterionPlane,
                std::shared_ptr< iolink::ImageView > outputColorImage = NULL );
This function returns the outputColorImage output parameter.
// Function prototype.
erosion_color_2d( input_color_image,
                  kernel_radius = 3,
                  criterion_plane = ErosionColor2d.CriterionPlane.LUMINANCE,
                  output_color_image = None )
This function returns the outputColorImage output parameter.
// Function prototype.
public static IOLink.ImageView
ErosionColor2d( IOLink.ImageView inputColorImage,
                Int32 kernelRadius = 3,
                ErosionColor2d.CriterionPlane criterionPlane = ImageDev.ErosionColor2d.CriterionPlane.LUMINANCE,
                IOLink.ImageView outputColorImage = null );

Class Syntax

Parameters

Class Name ErosionColor2d

Parameter Name Description Type Supported Values Default Value
input
inputColorImage
The input color image. Image Multispectral nullptr
input
kernelRadius
The half size of the square structuring element. A structuring element always has an odd side length (3x3, 5x5, etc.) which is defined by twice the kernel radius + 1. Int32 >=1 3
input
criterionPlane
The plane on which the criterion is computed.
LUMINANCE The operation is applied on the luminance component of the color image.
SATURATION The operation is applied on the saturation component of the color image.
Enumeration LUMINANCE
output
outputColorImage
The output color image. Its dimensions and type are forced to the same values as the input image. Image nullptr

Object Examples

std::shared_ptr< iolink::ImageView > ateneub = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "ateneub.jpg" );

ErosionColor2d erosionColor2dAlgo;
erosionColor2dAlgo.setInputColorImage( ateneub );
erosionColor2dAlgo.setKernelRadius( 3 );
erosionColor2dAlgo.setCriterionPlane( ErosionColor2d::CriterionPlane::LUMINANCE );
erosionColor2dAlgo.execute();

std::cout << "outputColorImage:" << erosionColor2dAlgo.outputColorImage()->toString();
ateneub = ioformat.read_image(imagedev_data.get_image_path("ateneub.jpg"))

erosion_color_2d_algo = imagedev.ErosionColor2d()
erosion_color_2d_algo.input_color_image = ateneub
erosion_color_2d_algo.kernel_radius = 3
erosion_color_2d_algo.criterion_plane = imagedev.ErosionColor2d.LUMINANCE
erosion_color_2d_algo.execute()

print( "output_color_image:", str( erosion_color_2d_algo.output_color_image ) )
ImageView ateneub = ViewIO.ReadImage( @"Data/images/ateneub.jpg" );

ErosionColor2d erosionColor2dAlgo = new ErosionColor2d
{
    inputColorImage = ateneub,
    kernelRadius = 3,
    criterionPlane = ErosionColor2d.CriterionPlane.LUMINANCE
};
erosionColor2dAlgo.Execute();

Console.WriteLine( "outputColorImage:" + erosionColor2dAlgo.outputColorImage.ToString() );

Function Examples

std::shared_ptr< iolink::ImageView > ateneub = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "ateneub.jpg" );

auto result = erosionColor2d( ateneub, 3, ErosionColor2d::CriterionPlane::LUMINANCE );

std::cout << "outputColorImage:" << result->toString();
ateneub = ioformat.read_image(imagedev_data.get_image_path("ateneub.jpg"))

result = imagedev.erosion_color_2d( ateneub, 3, imagedev.ErosionColor2d.LUMINANCE )

print( "output_color_image:", str( result ) )
ImageView ateneub = ViewIO.ReadImage( @"Data/images/ateneub.jpg" );

IOLink.ImageView result = Processing.ErosionColor2d( ateneub, 3, ErosionColor2d.CriterionPlane.LUMINANCE );

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