Skip to content

Laplacian

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

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

example: samples/cpp/snippets/laplace.cpp An example using Laplace filter for edge detection example: samples/python/snippets/laplace.py An example using Laplace filter for edge detection in python Calculates the Laplacian of an image.

The function calculates the Laplacian of the source image by adding up the second x and y derivatives calculated using the Sobel operator:

\texttt{dst} =  \Delta \texttt{src} =  \frac{\partial^2 \texttt{src}}{\partial x^2} +  \frac{\partial^2 \texttt{src}}{\partial y^2}

This is done when ksize > 1. When ksize == 1, the Laplacian is computed by filtering the image with the following 3 \times 3 aperture:

\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}

See: Sobel, Scharr

Laplacian(src: Mat, dst: Mat, ddepth: number, ksize: number, scale: number, delta: number, borderType: number): void;
5 available overloads
Laplacian(src: Mat, dst: Mat, ddepth: number): void;
Laplacian(src: Mat, dst: Mat, ddepth: number, ksize: number): void;
Laplacian(src: Mat, dst: Mat, ddepth: number, ksize: number, scale: number): void;
Laplacian(src: Mat, dst: Mat, ddepth: number, ksize: number, scale: number, delta: number): void;
Laplacian(src: Mat, dst: Mat, ddepth: number, ksize: number, scale: number, delta: number, borderType: number): void;
src

Source image.

dst

Output destination, filled by the native operation. Destination image of the same size and the same number of channels as src .

ddepth

Desired depth of the destination image, see filter_depths "combinations".

ksize

Aperture size used to compute the second-derivative filters. See #getDerivKernels for details. The size must be positive and odd.

scale

Optional scale factor for the computed Laplacian values. By default, no scaling is applied. See #getDerivKernels for details.

delta

Optional delta value that is added to the results prior to storing them in dst .

borderType

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

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.