[][src]Function opencv::imgproc::morphology_ex

pub fn morphology_ex(
    src: &dyn ToInputArray,
    dst: &mut dyn ToOutputArray,
    op: i32,
    kernel: &dyn ToInputArray,
    anchor: Point,
    iterations: i32,
    border_type: i32,
    border_value: Scalar
) -> Result<()>

Performs advanced morphological transformations.

The function cv::morphologyEx 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.

Parameters

  • src: Source image. The number of channels can be arbitrary. The depth should be one of CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
  • dst: Destination image of the same size and type as source image.
  • op: Type of a morphological operation, see #MorphTypes
  • kernel: Structuring element. It can be created using #getStructuringElement.
  • anchor: Anchor position with the kernel. 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
  • borderValue: Border value in case of a constant border. The default value has a special meaning.

See also

dilate, erode, getStructuringElement

Note: 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).

C++ default parameters

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