ImageDev

HMinima

Merges the regional minima 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 minima based on a contrast coefficient criterion $h$.

The input is added to the contrast coefficient $h$, then a grayscale reconstruction is performed on the result of this addition.
The regional minima of the reconstructed image are called the h-minima.

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

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 > hMinima( std::shared_ptr< iolink::ImageView > inputImage, int32_t contrast, HMinima::Neighborhood neighborhood, std::shared_ptr< iolink::ImageView > outputBinaryImage = NULL );
This function returns outputBinaryImage.
// Function prototype.
h_minima( input_image,
          contrast = 4,
          neighborhood = HMinima.Neighborhood.CONNECTIVITY_26,
          output_binary_image = None )
This function returns outputBinaryImage.
// Function prototype.
public static IOLink.ImageView
HMinima( IOLink.ImageView inputImage,
         Int32 contrast = 4,
         HMinima.Neighborhood neighborhood = ImageDev.HMinima.Neighborhood.CONNECTIVITY_26,
         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
Parameter Name Description Type Supported Values Default Value
input
input_image
The grayscale input image. image Grayscale None
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
output_binary_image
The binary output image. Its dimensions and type are forced to the same values as the input. image None
Parameter Name Description Type Supported Values Default Value
input
inputImage
The grayscale input image. Image Grayscale null
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 null

Object Examples

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

HMinima hMinimaAlgo;
hMinimaAlgo.setInputImage( foam );
hMinimaAlgo.setContrast( 4 );
hMinimaAlgo.setNeighborhood( HMinima::Neighborhood::CONNECTIVITY_26 );
hMinimaAlgo.execute();

std::cout << "outputBinaryImage:" << hMinimaAlgo.outputBinaryImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))

h_minima_algo = imagedev.HMinima()
h_minima_algo.input_image = foam
h_minima_algo.contrast = 4
h_minima_algo.neighborhood = imagedev.HMinima.CONNECTIVITY_26
h_minima_algo.execute()

print( "output_binary_image:", str( h_minima_algo.output_binary_image ) )
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );

HMinima hMinimaAlgo = new HMinima
{
    inputImage = foam,
    contrast = 4,
    neighborhood = HMinima.Neighborhood.CONNECTIVITY_26
};
hMinimaAlgo.Execute();

Console.WriteLine( "outputBinaryImage:" + hMinimaAlgo.outputBinaryImage.ToString() );

Function Examples

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

auto result = hMinima( foam, 4, HMinima::Neighborhood::CONNECTIVITY_26 );

std::cout << "outputBinaryImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))

result = imagedev.h_minima( foam, 4, imagedev.HMinima.CONNECTIVITY_26 )

print( "output_binary_image:", str( result ) )
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );

IOLink.ImageView result = Processing.HMinima( foam, 4, HMinima.Neighborhood.CONNECTIVITY_26 );

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