Skip to content

gapi_boxFilter

gapifunctionOpenCV 5.0.0
import { gapi_boxFilter } from '@banou/opencv-wasm'

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

ARGUMENTSsrc, dtype, ksize, anchor
FUNCTIONgapi_boxFilter
RETURN TYPEGMat
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Blurs an image using the box filter.

The function smooths an image using the kernel:

\texttt{K} =  \alpha \begin{bmatrix} 1 & 1 & 1 &  \cdots & 1 & 1  \\ 1 & 1 & 1 &  \cdots & 1 & 1  \\ \hdotsfor{6} \\ 1 & 1 & 1 &  \cdots & 1 & 1 \end{bmatrix}

where

\alpha = \begin{cases} \frac{1}{\texttt{ksize.width*ksize.height}} & \texttt{when } \texttt{normalize=true}  \\1 & \texttt{otherwise} \end{cases}

Unnormalized box filter is useful for computing various integral characteristics over each pixel neighborhood, such as covariance matrices of image derivatives (used in dense optical flow algorithms, and so on). If you need to compute pixel sums over variable-size windows, use cv::integral.

Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1. Output image must have the same type, size, and number of channels as the input image.

Note: - Rounding to nearest even is procedeed if hardware supports it, if not - to nearest.

  • Function textual ID is "org.opencv.imgproc.filters.boxfilter"

See: sepFilter, gaussianBlur, medianBlur, integral

gapi_boxFilter(src: GMat, dtype: number, ksize: Size, anchor: Point, normalize: boolean, borderType: number, borderValue: Scalar): GMat;
5 available overloads
gapi_boxFilter(src: GMat, dtype: number, ksize: Size): GMat;
gapi_boxFilter(src: GMat, dtype: number, ksize: Size, anchor: Point): GMat;
gapi_boxFilter(src: GMat, dtype: number, ksize: Size, anchor: Point, normalize: boolean): GMat;
gapi_boxFilter(src: GMat, dtype: number, ksize: Size, anchor: Point, normalize: boolean, borderType: number): GMat;
gapi_boxFilter(src: GMat, dtype: number, ksize: Size, anchor: Point, normalize: boolean, borderType: number, borderValue: Scalar): GMat;
src

Source image.

dtype

the output image depth (-1 to set the input image data type).

ksize

blurring kernel size.

anchor

Anchor position within the kernel. The default value (-1,-1) means that the anchor is at the kernel center.

normalize

flag, specifying whether the kernel is normalized by its area or not.

borderType

Pixel extrapolation method, see cv::BorderTypes

borderValue

border value in case of constant border type

Returns

The GMat 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.