Processing math: 100%
ImageDev

HMaxima

Merges the regional maxima in a grayscale image and marks them in a binary image.

Access to parameter description

This command is deprecated, it will be removed in ImageDev 2024.2.
You can use HExtrema2d or HExtrema3d instead.

For an introduction: This algorithm merges regional maxima 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 maxima of the reconstructed image are called the h-maxima.

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 maxima sets.
It also can be used as particle markers in various algorithms; for example, watershed detection.

<b> Figure 1.</b> One-dimensional example of a reconstruction by dilation
Figure 1. One-dimensional example of a reconstruction by dilation




Figure 2. Original image (left) and merged maxima in red (right, contrast=60).


Reference:
P. Soille, Morphological Image Analysis. Principles and Applications, Second Edition, Springer-Verlag, Berlin, pp.203-204, 2003.

See also

Function Syntax

This function returns outputBinaryImage.
// Function prototype
std::shared_ptr< iolink::ImageView > hMaxima( std::shared_ptr< iolink::ImageView > inputImage, int32_t contrast, HMaxima::Neighborhood neighborhood, std::shared_ptr< iolink::ImageView > outputBinaryImage = NULL );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The grayscale input image. Image Grayscale nullptr
input
contrast
The contrast level h. Int32 Any value 4
input
neighborhood
The 3D neighborhood configuration. This parameter is ignored with a 2D input image.
CONNECTIVITY_6 The structuring element is composed of voxels with a common face with the voxel of interest.
CONNECTIVITY_18 The structuring element is composed of voxels with at least one common edge.
CONNECTIVITY_26 The structuring element is a full cube.
Enumeration CONNECTIVITY_26
output
outputBinaryImage
The binary output image. Its dimensions and type are forced to the same values as the input. Image nullptr

Object Examples

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

HMaxima hMaximaAlgo;
hMaximaAlgo.setInputImage( foam );
hMaximaAlgo.setContrast( 4 );
hMaximaAlgo.setNeighborhood( HMaxima::Neighborhood::CONNECTIVITY_26 );
hMaximaAlgo.execute();

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

Function Examples

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

auto result = hMaxima( foam, 4, HMaxima::Neighborhood::CONNECTIVITY_26 );

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