Skip to content

filterSpeckles

stereofunctionOpenCV 5.0.0
import { filterSpeckles } from '@banou/opencv-wasm'

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

ARGUMENTSimg, newVal, maxSpeckleSize, maxDiff
FUNCTIONfilterSpeckles
RETURN TYPEvoid
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Filters off small noise blobs (speckles) in the disparity map

filterSpeckles(img: Mat, newVal: number, maxSpeckleSize: number, maxDiff: number, buf: Mat): void;
2 available overloads
filterSpeckles(img: Mat, newVal: number, maxSpeckleSize: number, maxDiff: number): void;
filterSpeckles(img: Mat, newVal: number, maxSpeckleSize: number, maxDiff: number, buf: Mat): void;
img

Input/output value, modified by the native operation. The input 16-bit signed disparity image

newVal

The disparity value used to paint-off the speckles

maxSpeckleSize

The maximum speckle size to consider it a speckle. Larger blobs are not affected by the algorithm

maxDiff

Maximum difference between neighbor disparity pixels to put them into the same blob. Note that since StereoBM, StereoSGBM and may be other algorithms return a fixed-point disparity map, where disparity values are multiplied by 16, this scale factor should be taken into account when specifying this parameter value.

buf

Input/output value, modified by the native operation. The optional temporary buffer to avoid memory allocation within the function.

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.