ImageDev

OpeningColor2d

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

Access to parameter description

For an introduction: This algorithm performs an opening on a true-color image, composed of 3 channels: red, green and blue.
The optimum 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 > openingColor2d( std::shared_ptr< iolink::ImageView > inputColorImage, int32_t kernelRadius, OpeningColor2d::CriterionPlane criterionPlane, std::shared_ptr< iolink::ImageView > outputColorImage = NULL );
This function returns outputColorImage.
// Function prototype.
opening_color_2d( input_color_image,
                  kernel_radius = 3,
                  criterion_plane = OpeningColor2d.CriterionPlane.LUMINANCE,
                  output_color_image = None )
This function returns outputColorImage.
// Function prototype.
public static IOLink.ImageView
OpeningColor2d( IOLink.ImageView inputColorImage,
                Int32 kernelRadius = 3,
                OpeningColor2d.CriterionPlane criterionPlane = ImageDev.OpeningColor2d.CriterionPlane.LUMINANCE,
                IOLink.ImageView outputColorImage = null );

Class Syntax

Parameters

Class Name OpeningColor2d

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" );

OpeningColor2d openingColor2dAlgo;
openingColor2dAlgo.setInputColorImage( ateneub );
openingColor2dAlgo.setKernelRadius( 3 );
openingColor2dAlgo.setCriterionPlane( OpeningColor2d::CriterionPlane::LUMINANCE );
openingColor2dAlgo.execute();

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

opening_color_2d_algo = imagedev.OpeningColor2d()
opening_color_2d_algo.input_color_image = ateneub
opening_color_2d_algo.kernel_radius = 3
opening_color_2d_algo.criterion_plane = imagedev.OpeningColor2d.LUMINANCE
opening_color_2d_algo.execute()

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

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

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

Function Examples

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

auto result = openingColor2d( ateneub, 3, OpeningColor2d::CriterionPlane::LUMINANCE );

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

result = imagedev.opening_color_2d( ateneub, 3, imagedev.OpeningColor2d.LUMINANCE )

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

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

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