Skip to content

thresholdWithMask

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

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

ARGUMENTSsrc, dst, mask, thresh
FUNCTIONthresholdWithMask
RETURN TYPEnumber
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Same as #threshold, but with an optional mask

Note: If the mask is empty, #thresholdWithMask is equivalent to #threshold. If the mask is not empty, dst must be of the same size and type as src, so that outliers pixels are left as-is

See: threshold, adaptiveThreshold, findContours, compare, min, max

thresholdWithMask(src: Mat, dst: Mat, mask: Mat, thresh: number, maxval: number, type_: number): number;
src

input array (multiple-channel, 8-bit or 32-bit floating point).

dst

Input/output value, modified by the native operation. output array of the same size and type and the same number of channels as src.

mask

optional mask (same size as src, 8-bit).

thresh

threshold value.

maxval

maximum value to use with the #THRESH_BINARY and #THRESH_BINARY_INV thresholding types.

type_

thresholding type (see #ThresholdTypes).

Returns

the computed threshold value if Otsu's or Triangle methods used.

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.