ImageDev

ClosingColor2d

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

Access to parameter description

For an introduction: This algorithm performs a closing on a true-color image composed of 3 channels: red, green and blue.
The maximum 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 maximum luminance or saturation.
With this method, no new color is created.

See also

Function Syntax

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

Class Syntax

Parameters

Class Name ClosingColor2d

Parameter Name Description Type Supported Values Default Value
input
inputColorImage
The input color image. Image Multispectral nullptr
input
kernelRadius
The half size of the structuring element in pixels. 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" );

ClosingColor2d closingColor2dAlgo;
closingColor2dAlgo.setInputColorImage( ateneub );
closingColor2dAlgo.setKernelRadius( 3 );
closingColor2dAlgo.setCriterionPlane( ClosingColor2d::CriterionPlane::LUMINANCE );
closingColor2dAlgo.execute();

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

closing_color_2d_algo = imagedev.ClosingColor2d()
closing_color_2d_algo.input_color_image = ateneub
closing_color_2d_algo.kernel_radius = 3
closing_color_2d_algo.criterion_plane = imagedev.ClosingColor2d.LUMINANCE
closing_color_2d_algo.execute()

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

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

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

Function Examples

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

auto result = closingColor2d( ateneub, 3, ClosingColor2d::CriterionPlane::LUMINANCE );

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

result = imagedev.closing_color_2d( ateneub, 3, imagedev.ClosingColor2d.LUMINANCE )

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

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

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