ImageDev

HExtrema2d

Merges the regional extrema in a 2d grayscale image and marks them in 2d a binary image.

Access to parameter description

For an introduction: This algorithm merges regional extrema based on a contrast coefficient criterion h.
The input is subtracted from the contrast coefficient h, then a grayscale reconstruction is performed on the result of this subtraction.
The regional extrema of the reconstructed image are called the HExtrema.
The algorithm only works with homogeneous gray level objects. The appropriate h value depends on the local contrast between the gray level objects to detect. Increasing this factor too much may eliminate some previously merged objects.
This algorithm is useful for filtering noisy extrema sets. It also can be used as particle markers in various algorithms; for example, watershed detection.
See also

Function Syntax

This function returns outputBinaryImage.
// Function prototype
std::shared_ptr< iolink::ImageView > hExtrema2d( std::shared_ptr< iolink::ImageView > inputImage, HExtrema2d::ExtremaType extremaType, uint32_t contrast, HExtrema2d::Neighborhood neighborhood, std::shared_ptr< iolink::ImageView > outputBinaryImage = NULL );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input grayscale image. Image Grayscale nullptr
input
extremaType
The type of extrema to detect.
MAXIMA The regional maxima are extracted from the input image.
MINIMA The regional minima are extracted from the input image.
Enumeration MAXIMA
input
contrast
The contrast level h. UInt32 Any value 4
input
neighborhood
The 2D neighborhood configuration.
CONNECTIVITY_4 The structuring element is a cross.
CONNECTIVITY_8 The structuring element is a square.
Enumeration CONNECTIVITY_8
output
outputBinaryImage
The output binary. Its dimensions is forced to the same values as the input. Image nullptr

Object Examples

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

HExtrema2d hExtrema2dAlgo;
hExtrema2dAlgo.setInputImage( polystyrene );
hExtrema2dAlgo.setExtremaType( HExtrema2d::ExtremaType::MAXIMA );
hExtrema2dAlgo.setContrast( 4 );
hExtrema2dAlgo.setNeighborhood( HExtrema2d::Neighborhood::CONNECTIVITY_8 );
hExtrema2dAlgo.execute();

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

Function Examples

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

auto result = hExtrema2d( polystyrene, HExtrema2d::ExtremaType::MAXIMA, 4, HExtrema2d::Neighborhood::CONNECTIVITY_8 );

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