getGaussianKernel
import { getGaussianKernel } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
imgproc_feature
Returns Gaussian filter coefficients.
The function computes and returns the \texttt{ksize} \times 1 matrix of Gaussian filter
coefficients:
G_i= \alpha *e^{-(i-( \texttt{ksize} -1)/2)^2/(2* \texttt{sigma}^2)},
where i=0..\texttt{ksize}-1 and \alpha is the scale factor chosen so that \sum_i G_i=1.
Two of such generated kernels can be passed to sepFilter2D. Those functions automatically recognize smoothing kernels (a symmetrical kernel with sum of weights equal to 1) and handle them accordingly. You may also use the higher-level GaussianBlur.
See: sepFilter2D, getDerivKernels, getStructuringElement, GaussianBlur
getGaussianKernel(ksize: number, sigma: number, ktype: number): Mat;2 available overloads
getGaussianKernel(ksize: number, sigma: number): Mat;getGaussianKernel(ksize: number, sigma: number, ktype: number): Mat;ksizeAperture size. It should be odd (
\texttt{ksize} \mod 2 = 1) and positive.sigmaGaussian standard deviation. If it is non-positive, it is computed from ksize as
sigma = 0.3*((ksize-1)*0.5 - 1) + 0.8.ktypeType of filter coefficients. It can be CV_32F or CV_64F .
The Mat result. Release returned native handles with using or delete(), including handles nested in results.
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.