gapi_SobelXY
import { gapi_SobelXY } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
In all cases except one, the \texttt{ksize} \times \texttt{ksize} separable kernel is used to
calculate the derivative. When \texttt{ksize = 1}, the 3 \times 1 or 1 \times 3
kernel is used (that is, no Gaussian smoothing is done). ksize = 1 can only be used for the first
or the second x- or y- derivatives.
There is also the special value ksize = FILTER_SCHARR (-1) that corresponds to the 3\times3 Scharr
filter that may give more accurate results than the 3\times3 Sobel. The Scharr aperture is
\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}
for the x-derivative, or transposed for the y-derivative.
The function calculates an image derivative by convolving the image with the appropriate kernel:
\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}
The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3) or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first case corresponds to a kernel of:
\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}
The second case corresponds to a kernel of:
\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}
Note: - First returned matrix correspons to dx derivative while the second one to dy.
- Rounding to nearest even is procedeed if hardware supports it, if not - to nearest.
- Function textual ID is "org.opencv.imgproc.filters.sobelxy"
See: filter2D, gaussianBlur, cartToPolar
gapi_SobelXY(src: GMat, ddepth: number, order: number, ksize: number, scale: number, delta: number, borderType: number, borderValue: Scalar): tuple_GMat_and_GMat;6 available overloads
gapi_SobelXY(src: GMat, ddepth: number, order: number): tuple_GMat_and_GMat;gapi_SobelXY(src: GMat, ddepth: number, order: number, ksize: number): tuple_GMat_and_GMat;gapi_SobelXY(src: GMat, ddepth: number, order: number, ksize: number, scale: number): tuple_GMat_and_GMat;gapi_SobelXY(src: GMat, ddepth: number, order: number, ksize: number, scale: number, delta: number): tuple_GMat_and_GMat;gapi_SobelXY(src: GMat, ddepth: number, order: number, ksize: number, scale: number, delta: number, borderType: number): tuple_GMat_and_GMat;gapi_SobelXY(src: GMat, ddepth: number, order: number, ksize: number, scale: number, delta: number, borderType: number, borderValue: Scalar): tuple_GMat_and_GMat;srcinput image.
ddepthoutput image depth, see
filter_depths"combinations"; in the case of 8-bit input images it will result in truncated derivatives.orderorder of the derivatives.
ksizesize of the extended Sobel kernel; it must be odd.
scaleoptional scale factor for the computed derivative values; by default, no scaling is applied (see cv::getDerivKernels for details).
deltaoptional delta value that is added to the results prior to storing them in dst.
borderTypepixel extrapolation method, see cv::BorderTypes
borderValueborder value in case of constant border type
The tuple_GMat_and_GMat result.
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.