MorphologicalGradient3d
Approximates an image gradient by using morphological operations.
Access to parameter description
For an introduction:
Three modes are available to enhance edges inside particles (Internal), outside particles (External) or on the particle borders (Centered).
Figure 1. The Morphological Gradient effects with label image in overlay:
(a) input gray level image, (b) internal morphological gradient, (c) external morphological gradient
This algorithm uses ErosionBall3d or DilationBall3d and combine them as follows:
The morphological gradient can be considered as a non-linear high-pass filter. The bright edges are enhanced with a thickness proportional to the size of the structuring element. It is an approximation of the gradient modulus.
Two additional parameters are also provided:
Access to parameter description
For an introduction:
- section Edge Detection
- section Gradient
- section Morphology
Three modes are available to enhance edges inside particles (Internal), outside particles (External) or on the particle borders (Centered).
(a) |
(b) |
(c) |
(a) input gray level image, (b) internal morphological gradient, (c) external morphological gradient
This algorithm uses ErosionBall3d or DilationBall3d and combine them as follows:
- Internal: $ O = I-E_B(I)$
- External: $ O = D_B(I)-I$
- Centered $ O = D_B(I)-E_B(I)$
The morphological gradient can be considered as a non-linear high-pass filter. The bright edges are enhanced with a thickness proportional to the size of the structuring element. It is an approximation of the gradient modulus.
Two additional parameters are also provided:
- The computation mode for morphological erosion and dilation: Fast or Precise.
- The size of structuring element for morphological operations.
Function Syntax
This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > morphologicalGradient3d( std::shared_ptr< iolink::ImageView > inputImage, uint32_t kernelRadius, MorphologicalGradient3d::GradientMode gradientMode, MorphologicalGradient3d::Precision precision, std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns outputImage.
// Function prototype. morphological_gradient_3d( input_image, kernel_radius = 3, gradient_mode = MorphologicalGradient3d.GradientMode.INTERNAL, precision = MorphologicalGradient3d.Precision.FASTER, output_image = None )
This function returns outputImage.
// Function prototype. public static IOLink.ImageView MorphologicalGradient3d( IOLink.ImageView inputImage, UInt32 kernelRadius = 3, MorphologicalGradient3d.GradientMode gradientMode = ImageDev.MorphologicalGradient3d.GradientMode.INTERNAL, MorphologicalGradient3d.Precision precision = ImageDev.MorphologicalGradient3d.Precision.FASTER, IOLink.ImageView outputImage = null );
Class Syntax
Parameters
Class Name | MorphologicalGradient3d |
---|
Parameter Name | Description | Type | Supported Values | Default Value | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
inputImage |
The input image. | Image | Binary, Label, Grayscale or Multispectral | nullptr | |||||||
kernelRadius |
The radius in pixels of the sphere structuring element used for morphological erosion and dilation. In centered mode, it corresponds to the thickness of the extracted edges and to their half thickness in other modes. | UInt32 | >=1 | 3 | |||||||
precision |
The precision for computation for morphological operations.
|
Enumeration | FASTER | ||||||||
gradientMode |
The computation mode of morphological gradient.
|
Enumeration | INTERNAL | ||||||||
outputImage |
The output image. | Image | nullptr |
Object Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); MorphologicalGradient3d morphologicalGradient3dAlgo; morphologicalGradient3dAlgo.setInputImage( foam ); morphologicalGradient3dAlgo.setKernelRadius( 3 ); morphologicalGradient3dAlgo.setGradientMode( MorphologicalGradient3d::GradientMode::INTERNAL ); morphologicalGradient3dAlgo.setPrecision( MorphologicalGradient3d::Precision::FASTER ); morphologicalGradient3dAlgo.execute(); std::cout << "outputImage:" << morphologicalGradient3dAlgo.outputImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip")) morphological_gradient_3d_algo = imagedev.MorphologicalGradient3d() morphological_gradient_3d_algo.input_image = foam morphological_gradient_3d_algo.kernel_radius = 3 morphological_gradient_3d_algo.gradient_mode = imagedev.MorphologicalGradient3d.INTERNAL morphological_gradient_3d_algo.precision = imagedev.MorphologicalGradient3d.FASTER morphological_gradient_3d_algo.execute() print( "output_image:", str( morphological_gradient_3d_algo.output_image ) )
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); MorphologicalGradient3d morphologicalGradient3dAlgo = new MorphologicalGradient3d { inputImage = foam, kernelRadius = 3, gradientMode = MorphologicalGradient3d.GradientMode.INTERNAL, precision = MorphologicalGradient3d.Precision.FASTER }; morphologicalGradient3dAlgo.Execute(); Console.WriteLine( "outputImage:" + morphologicalGradient3dAlgo.outputImage.ToString() );
Function Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); auto result = morphologicalGradient3d( foam, 3, MorphologicalGradient3d::GradientMode::INTERNAL, MorphologicalGradient3d::Precision::FASTER ); std::cout << "outputImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip")) result = imagedev.morphological_gradient_3d( foam, 3, imagedev.MorphologicalGradient3d.INTERNAL, imagedev.MorphologicalGradient3d.FASTER ) print( "output_image:", str( result ) )
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); IOLink.ImageView result = Processing.MorphologicalGradient3d( foam, 3, MorphologicalGradient3d.GradientMode.INTERNAL, MorphologicalGradient3d.Precision.FASTER ); Console.WriteLine( "outputImage:" + result.ToString() );