ImageDev

SelectiveOpening2d

Opens objects of a two-dimensional binary image conditionally to a local constraint.

Access to parameter description

For an introduction: This algorithm successively runs a SelectiveErosion2d and a SelectiveDilation2d with the same kernel and threshold.
It can be applied only on binary images. Using a threshold of 1 amounts to applying a standard morphological opening.
This operator is smoother than the classic opening, and softens the appearance of the structuring element in the filtered image.

See also

Function Syntax

This function returns the outputBinaryImage output parameter.
// Function prototype.
std::shared_ptr< iolink::ImageView >
selectiveOpening2d( std::shared_ptr< iolink::ImageView > inputBinaryImage,
                    uint32_t numberOfIterations,
                    uint32_t threshold,
                    std::shared_ptr< iolink::ImageView > outputBinaryImage = NULL );

Class Syntax

Parameters

Class Name SelectiveOpening2d

Parameter Name Description Type Supported Values Default Value
input
inputBinaryImage
The binary input image. Image Binary nullptr
input
numberOfIterations
The number of iterations. UInt32 >=1 3
input
threshold
The minimum number of neighbors that is required to transform a pixel. UInt32 [1, 8] 5
output
outputBinaryImage
The binary output image. Its size and type are forced to the same values as the input. Image nullptr

Object Examples

auto polystyrene_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep.vip" );

SelectiveOpening2d selectiveOpening2dAlgo;
selectiveOpening2dAlgo.setInputBinaryImage( polystyrene_sep );
selectiveOpening2dAlgo.setNumberOfIterations( 3 );
selectiveOpening2dAlgo.setThreshold( 5 );
selectiveOpening2dAlgo.execute();

std::cout << "outputBinaryImage:" << selectiveOpening2dAlgo.outputBinaryImage()->toString();

Function Examples

auto polystyrene_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep.vip" );

auto result = selectiveOpening2d( polystyrene_sep, 3, 5 );

std::cout << "outputBinaryImage:" << result->toString();