Skip to content

dilate

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

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

example: samples/cpp/tutorial_code/ImgProc/Morphology_1.cpp Erosion and Dilation sample code Sample Screenshot-ErosionSample Screenshot-Dilation Check tutorial_erosion_dilatation "the corresponding tutorial" for more details Dilates an image by using a specific structuring element.

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

\texttt{dst} (x,y) =  \max _{(x',y'):  \, \texttt{kernel} (x',y') \ne0 } \texttt{src} (x+x',y+y')

The function supports the in-place mode. Dilation can be applied several ( iterations ) times. In case of multi-channel images, each channel is processed independently.

See: erode, morphologyEx, getStructuringElement

dilate(src: Mat, dst: Mat, kernel: Mat, anchor: Point, iterations: number, borderType: number, borderValue: Scalar): void;
5 available overloads
dilate(src: Mat, dst: Mat, kernel: Mat): void;
dilate(src: Mat, dst: Mat, kernel: Mat, anchor: Point): void;
dilate(src: Mat, dst: Mat, kernel: Mat, anchor: Point, iterations: number): void;
dilate(src: Mat, dst: Mat, kernel: Mat, anchor: Point, iterations: number, borderType: number): void;
dilate(src: Mat, dst: Mat, kernel: Mat, anchor: Point, iterations: number, borderType: number, borderValue: Scalar): void;
src

input 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.

dst

Output destination, filled by the native operation. output image of the same size and type as src.

kernel

structuring element used for dilation; if kernel=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 dilation is applied.

borderType

pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.

borderValue

border 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.