erode
import { erode } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
imgproc_feature
example: samples/cpp/tutorial_code/ImgProc/Morphology_2.cpp
Advanced morphology Transformations sample code
Check tutorial_opening_closing_hats "the corresponding tutorial" for more details
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:
\texttt{dst} (x,y) = \min _{(x',y'): \, \texttt{kernel} (x',y') \ne0 } \texttt{src} (x+x',y+y')
The function supports the in-place mode. Erosion can be applied several ( iterations ) times. In case of multi-channel images, each channel is processed independently.
See: dilate, morphologyEx, getStructuringElement
erode(src: Mat, dst: Mat, kernel: Mat, anchor: Point, iterations: number, borderType: number, borderValue: Scalar): void;5 available overloads
erode(src: Mat, dst: Mat, kernel: Mat): void;erode(src: Mat, dst: Mat, kernel: Mat, anchor: Point): void;erode(src: Mat, dst: Mat, kernel: Mat, anchor: Point, iterations: number): void;erode(src: Mat, dst: Mat, kernel: Mat, anchor: Point, iterations: number, borderType: number): void;erode(src: Mat, dst: Mat, kernel: Mat, anchor: Point, iterations: number, borderType: number, borderValue: Scalar): void;srcinput image; the number of channels can be arbitrary, but the depth should be one of CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
dstOutput destination, filled by the native operation. output image of the same size and type as src.
kernelstructuring element used for erosion; if
kernel=Mat(), a3 x 3rectangular structuring element is used. Kernel can be created using #getStructuringElement.anchorposition of the anchor within the element; default value (-1, -1) means that the anchor is at the element center.
iterationsnumber of times erosion is applied.
borderTypepixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
borderValueborder value in case of a constant border
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.