Function erode_def

Source
pub fn erode_def(
    src: &impl GMatTraitConst,
    kernel: &impl MatTraitConst,
) -> Result<GMat>
Expand description

Erodes an image by using a specific structuring element.

The function erodes the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the minimum is taken:

block formula

Erosion can be applied several (iterations) times. In case of multi-channel images, each channel is processed independently. Supported input matrix data types are [CV_8UC1], [CV_8UC3], [CV_16UC1], [CV_16SC1], and [CV_32FC1]. Output image must have the same type, size, and number of channels as the input image.

Note:

  • Rounding to nearest even is procedeed if hardware supports it, if not - to nearest.
  • Function textual ID is “org.opencv.imgproc.filters.erode”

§Parameters

  • src: input image
  • kernel: structuring element used for erosion; if element=Mat(), a 3 x 3 rectangular structuring element is used. Kernel can be created using getStructuringElement.
  • anchor: position of the anchor within the element; default value (-1, -1) means that the anchor is at the element center.
  • iterations: number of times erosion is applied.
  • borderType: pixel extrapolation method, see cv::BorderTypes
  • borderValue: border value in case of a constant border

§See also

dilate, morphologyEx

§Note

This alternative version of erode function uses the following default values for its arguments:

  • anchor: Point(-1,-1)
  • iterations: 1
  • border_type: BORDER_CONSTANT
  • border_value: morphologyDefaultBorderValue()