opencv::gapi

Function morphology_ex_def

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

Performs advanced morphological transformations.

The function can perform advanced morphological transformations using an erosion and dilation as basic operations.

Any of the operations can be done in-place. In case of multi-channel images, each channel is processed independently.

Note:

  • Function textual ID is “org.opencv.imgproc.filters.morphologyEx”
  • The number of iterations is the number of times erosion or dilatation operation will be applied. For instance, an opening operation (#MORPH_OPEN) with two iterations is equivalent to apply successively: erode -> erode -> dilate -> dilate (and not erode -> dilate -> erode -> dilate).

§Parameters

  • src: Input image.
  • op: Type of a morphological operation, see [morph_types]
  • kernel: Structuring element. It can be created using #getStructuringElement.
  • anchor: Anchor position within the element. Both negative values mean that the anchor is at the kernel center.
  • iterations: Number of times erosion and dilation are applied.
  • borderType: Pixel extrapolation method, see #BorderTypes. [BORDER_WRAP] is not supported.
  • borderValue: Border value in case of a constant border. The default value has a special meaning.

§See also

dilate, erode, getStructuringElement

§Note

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

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