Morphological edge detector
#include "dip_morphology.h"
dip_Error dip_MultiScaleMorphologicalGradient ( in, out, se, boundary, upperSize, lowerSize, shape )
integer, float
This function computes the average morphological gradient over a range of scales bounded by upperSize and lowerSize. The morphological gradient is computed as the difference of the dilation and erosion of the input image at a particular scale, eroded by an erosion of one size smaller. At the lowest scale, the size of the structuring element is 2 * upperSize + 1.
The rectangular, elliptic and diamond structuring elements are "flat", i.e. these structuring elements have a constant value. For these structuring elements, param determines the sizes of the structuring elements.
When shape is DIP_FLT_SHAPE_DISCRETE_LINE or DIP_FLT_SHAPE_INTERPOLATED_LINE, the structuring element is a line. param->array[0] determines the length, param->array[1] the angle. This is currently only supported for 2D images. Interpolated lines use interpolation to obtain a more accurate result, but loose the strict increasingness and extensivity (these properties are satisfied only by approximation).
When shape is set to DIP_FLT_SHAPE_PARABOLIC, params specifies the curvature of the parabola.
When shape is set to DIP_FLT_SHAPE_STRUCTURING_ELEMENT, se is used as structuring element. It can be either a binary or a grey-value image. Its origin is the center, or one pixel to the left of the center if the size is even.
If shape is not equal to DIP_FLT_SHAPE_STRUCTURING_ELEMENT, se can be set to zero. When shape is set to DIP_FLT_SHAPE_STRUCTURING_ELEMENT, param is ignored, and can be set to zero.
Data type | Name | Description |
dip_Image | in | Input |
dip_Image | out | Output |
dip_Image | se | Custom structuring element |
dip_BoundaryArray | boundary | Boundary conditions |
dip_int | upperSize | Upper size of structuring element |
dip_int | lowerSize | Lower size of structuring element |
dip_FilterShape | shape | Structuring element |
The enumerator dip_FilterShape contains the following constants:
Name | Description |
DIP_FLT_SHAPE_DEFAULT | Default filter window, same as DIP_FLT_SHAPE_RECTANGULAR |
DIP_FLT_SHAPE_RECTANGULAR | Rectangular filter window, can be even in size |
DIP_FLT_SHAPE_ELLIPTIC | Elliptic filter window, always odd in size |
DIP_FLT_SHAPE_DIAMOND | Diamond-shaped filter window, always odd in size |
DIP_FLT_SHAPE_PARABOLIC | Parabolic filter window (morphology only) |
DIP_FLT_SHAPE_DISCRETE_LINE | Rotated line structuring element (morphology only) |
DIP_FLT_SHAPE_INTERPOLATED_LINE | Rotated line structuring element, through interpolation (morphology only) |
DIP_FLT_SHAPE_PERIODIC_LINE | (not implemented) |
DIP_FLT_SHAPE_STRUCTURING_ELEMENT | Use se as filter window, can be any size |
D. Wang, Pattern Recognition, 30(12), pp. 2043-2052, 1997
Lee, MorphologicalGradientMagnitude, MorphologicalRange, Tophat