RegionalExtrema2d
Computes the regional maxima or minima of a two-dimensional grayscale image and marks them in a binary image.
Access to parameter description
For an introduction:
A regional maximum (resp. minimum) $C$ is a set of connected pixels such that:
Figure 1. One-dimensional example of a regional maxima detection
Figure 2. One-dimensional example of a regional minima detection
This algorithm uses a recursive method combined with a geodesic propagation.
To avoid getting too many regions in the output image, the input should be smoothed first with a low-pass filter or with the numerical reconstruction algorithm.
Figure 3. Original image (left) and regional maxima in red (right)
Reference:
P. Soille, Morphological Image Analysis. Principles and Applications, Second Edition, Springer-Verlag, Berlin, pp.201-203, 2003.
See also
Access to parameter description
For an introduction:
- section Mathematical Morphology
- section Geodesic Transformations
A regional maximum (resp. minimum) $C$ is a set of connected pixels such that:
- Pixels belonging to $C$ have the same intensity $I_C$.
- Pixels connected to $C$, but not belonging to $C$ (neighbors), have an intensity strictly lower (resp. greater) than $I_C$.
Figure 1. One-dimensional example of a regional maxima detection
Figure 2. One-dimensional example of a regional minima detection
This algorithm uses a recursive method combined with a geodesic propagation.
To avoid getting too many regions in the output image, the input should be smoothed first with a low-pass filter or with the numerical reconstruction algorithm.
|
|
Reference:
P. Soille, Morphological Image Analysis. Principles and Applications, Second Edition, Springer-Verlag, Berlin, pp.201-203, 2003.
See also
Function Syntax
This function returns outputBinaryImage.
// Function prototype
std::shared_ptr< iolink::ImageView > regionalExtrema2d( std::shared_ptr< iolink::ImageView > inputImage, RegionalExtrema2d::ExtremaType extremaType, RegionalExtrema2d::Neighborhood neighborhood, std::shared_ptr< iolink::ImageView > outputBinaryImage = nullptr );
This function returns outputBinaryImage.
// Function prototype. regional_extrema_2d(input_image: idt.ImageType, extrema_type: RegionalExtrema2d.ExtremaType = RegionalExtrema2d.ExtremaType.MAXIMA, neighborhood: RegionalExtrema2d.Neighborhood = RegionalExtrema2d.Neighborhood.CONNECTIVITY_8, output_binary_image: idt.ImageType = None) -> idt.ImageType
This function returns outputBinaryImage.
// Function prototype. public static IOLink.ImageView RegionalExtrema2d( IOLink.ImageView inputImage, RegionalExtrema2d.ExtremaType extremaType = ImageDev.RegionalExtrema2d.ExtremaType.MAXIMA, RegionalExtrema2d.Neighborhood neighborhood = ImageDev.RegionalExtrema2d.Neighborhood.CONNECTIVITY_8, IOLink.ImageView outputBinaryImage = null );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |||||
---|---|---|---|---|---|---|---|---|---|
inputImage |
The input grayscale image. | Image | Grayscale | nullptr | |||||
extremaType |
The type of extrema to detect.
|
Enumeration | MAXIMA | ||||||
neighborhood |
The 2D neighborhood configuration used for geodesic propagation.
|
Enumeration | CONNECTIVITY_8 | ||||||
outputBinaryImage |
The output binary image. Its dimensions are forced to the same values as the input. | Image | nullptr |
Parameter Name | Description | Type | Supported Values | Default Value | |||||
---|---|---|---|---|---|---|---|---|---|
input_image |
The input grayscale image. | image | Grayscale | None | |||||
extrema_type |
The type of extrema to detect.
|
enumeration | MAXIMA | ||||||
neighborhood |
The 2D neighborhood configuration used for geodesic propagation.
|
enumeration | CONNECTIVITY_8 | ||||||
output_binary_image |
The output binary image. Its dimensions are forced to the same values as the input. | image | None |
Parameter Name | Description | Type | Supported Values | Default Value | |||||
---|---|---|---|---|---|---|---|---|---|
inputImage |
The input grayscale image. | Image | Grayscale | null | |||||
extremaType |
The type of extrema to detect.
|
Enumeration | MAXIMA | ||||||
neighborhood |
The 2D neighborhood configuration used for geodesic propagation.
|
Enumeration | CONNECTIVITY_8 | ||||||
outputBinaryImage |
The output binary image. Its dimensions are forced to the same values as the input. | Image | null |
Object Examples
auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); RegionalExtrema2d regionalExtrema2dAlgo; regionalExtrema2dAlgo.setInputImage( polystyrene ); regionalExtrema2dAlgo.setExtremaType( RegionalExtrema2d::ExtremaType::MAXIMA ); regionalExtrema2dAlgo.setNeighborhood( RegionalExtrema2d::Neighborhood::CONNECTIVITY_8 ); regionalExtrema2dAlgo.execute(); std::cout << "outputBinaryImage:" << regionalExtrema2dAlgo.outputBinaryImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) regional_extrema_2d_algo = imagedev.RegionalExtrema2d() regional_extrema_2d_algo.input_image = polystyrene regional_extrema_2d_algo.extrema_type = imagedev.RegionalExtrema2d.MAXIMA regional_extrema_2d_algo.neighborhood = imagedev.RegionalExtrema2d.CONNECTIVITY_8 regional_extrema_2d_algo.execute() print("output_binary_image:", str(regional_extrema_2d_algo.output_binary_image))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); RegionalExtrema2d regionalExtrema2dAlgo = new RegionalExtrema2d { inputImage = polystyrene, extremaType = RegionalExtrema2d.ExtremaType.MAXIMA, neighborhood = RegionalExtrema2d.Neighborhood.CONNECTIVITY_8 }; regionalExtrema2dAlgo.Execute(); Console.WriteLine( "outputBinaryImage:" + regionalExtrema2dAlgo.outputBinaryImage.ToString() );
Function Examples
auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto result = regionalExtrema2d( polystyrene, RegionalExtrema2d::ExtremaType::MAXIMA, RegionalExtrema2d::Neighborhood::CONNECTIVITY_8 ); std::cout << "outputBinaryImage:" << result->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) result = imagedev.regional_extrema_2d(polystyrene, imagedev.RegionalExtrema2d.MAXIMA, imagedev.RegionalExtrema2d.CONNECTIVITY_8) print("output_binary_image:", str(result))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); IOLink.ImageView result = Processing.RegionalExtrema2d( polystyrene, RegionalExtrema2d.ExtremaType.MAXIMA, RegionalExtrema2d.Neighborhood.CONNECTIVITY_8 ); Console.WriteLine( "outputBinaryImage:" + result.ToString() );