boxFilter
import { boxFilter } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
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 #integral.
See: blur, bilateralFilter, GaussianBlur, medianBlur, integral
boxFilter(src: Mat, dst: Mat, ddepth: number, ksize: Size, anchor: Point, normalize: boolean, borderType: number): void;4 available overloads
boxFilter(src: Mat, dst: Mat, ddepth: number, ksize: Size): void;boxFilter(src: Mat, dst: Mat, ddepth: number, ksize: Size, anchor: Point): void;boxFilter(src: Mat, dst: Mat, ddepth: number, ksize: Size, anchor: Point, normalize: boolean): void;boxFilter(src: Mat, dst: Mat, ddepth: number, ksize: Size, anchor: Point, normalize: boolean, borderType: number): void;srcinput image.
dstOutput destination, filled by the native operation. output image of the same size and type as src.
ddepththe output image depth (-1 to use src.depth()).
ksizeblurring kernel size.
anchoranchor point; default value Point(-1,-1) means that the anchor is at the kernel center.
normalizeflag, specifying whether the kernel is normalized by its area or not.
borderTypeborder mode used to extrapolate pixels outside of the image, 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.