Skip to content

blur

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

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

Blurs an image using the normalized box filter.

The function smooths an image using the kernel:

\texttt{K} =  \frac{1}{\texttt{ksize.width*ksize.height}} \begin{bmatrix} 1 & 1 & 1 &  \cdots & 1 & 1  \\ 1 & 1 & 1 &  \cdots & 1 & 1  \\ \hdotsfor{6} \\ 1 & 1 & 1 &  \cdots & 1 & 1  \\ \end{bmatrix}

The call blur(src, dst, ksize, anchor, borderType) is equivalent to boxFilter(src, dst, src.type(), ksize, anchor, true, borderType).

See: boxFilter, bilateralFilter, GaussianBlur, medianBlur

blur(src: Mat, dst: Mat, ksize: Size, anchor: Point, borderType: number): void;
3 available overloads
blur(src: Mat, dst: Mat, ksize: Size): void;
blur(src: Mat, dst: Mat, ksize: Size, anchor: Point): void;
blur(src: Mat, dst: Mat, ksize: Size, anchor: Point, borderType: number): void;
src

input image; it can have any number of channels, which are processed independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.

dst

Output destination, filled by the native operation. output image of the same size and type as src.

ksize

blurring kernel size.

anchor

anchor point; default value Point(-1,-1) means that the anchor is at the kernel center.

borderType

border 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.