Skip to content

spatialGradient

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

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

ARGUMENTSsrc, dx, dy, ksize
FUNCTIONspatialGradient
RETURN TYPEvoid
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Calculates the first order image derivative in both x and y using a Sobel operator

Equivalent to calling:

Sobel( src, dx, CV_16SC1, 1, 0, 3 );
Sobel( src, dy, CV_16SC1, 0, 1, 3 );

See: Sobel

spatialGradient(src: Mat, dx: Mat, dy: Mat, ksize: number, borderType: number): void;
3 available overloads
spatialGradient(src: Mat, dx: Mat, dy: Mat): void;
spatialGradient(src: Mat, dx: Mat, dy: Mat, ksize: number): void;
spatialGradient(src: Mat, dx: Mat, dy: Mat, ksize: number, borderType: number): void;
src

input image.

dx

Output destination, filled by the native operation. output image with first-order derivative in x.

dy

Output destination, filled by the native operation. output image with first-order derivative in y.

ksize

size of Sobel kernel. It must be 3.

borderType

pixel extrapolation method, see #BorderTypes. Only #BORDER_DEFAULT=#BORDER_REFLECT_101 and #BORDER_REPLICATE are 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.