Skip to content

morphologyEx

Image processingfunctionOpenCV 5.0.0
import { morphologyEx } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

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.

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

morphologyEx(src: Mat, dst: Mat, op: number, kernel: Mat, anchor: Point, iterations: number, borderType: number, borderValue: Scalar): void;
5 available overloads
morphologyEx(src: Mat, dst: Mat, op: number, kernel: Mat): void;
morphologyEx(src: Mat, dst: Mat, op: number, kernel: Mat, anchor: Point): void;
morphologyEx(src: Mat, dst: Mat, op: number, kernel: Mat, anchor: Point, iterations: number): void;
morphologyEx(src: Mat, dst: Mat, op: number, kernel: Mat, anchor: Point, iterations: number, borderType: number): void;
morphologyEx(src: Mat, dst: Mat, op: number, kernel: Mat, anchor: Point, iterations: number, borderType: number, borderValue: Scalar): void;
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

Output destination, filled by the native operation. 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. #BORDER_WRAP is not supported.

borderValue

Border value in case of a constant border. The default value has a special meaning.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.