Skip to content

hasNonZero

Core and matricesfunctionOpenCV 5.0.0
import { hasNonZero } from '@banou/opencv-wasm'

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

ARGUMENTSsrc
FUNCTIONhasNonZero
RETURN TYPEboolean
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Checks for the presence of at least one non-zero array element.

The function returns whether there are non-zero elements in src

The function do not work with multi-channel arrays. If you need to check non-zero array elements across all the channels, use Mat::reshape first to reinterpret the array as single-channel. Or you may extract the particular channel using either extractImageCOI, or mixChannels, or split.

Note: - CV_16F/CV_16BF/CV_Bool/CV_64U/CV_64S/CV_32U are not supported for src.

  • If the location of non-zero array elements is important, findNonZero is helpful.
  • If the count of non-zero array elements is important, countNonZero is helpful.

See: mean, meanStdDev, norm, minMaxLoc, calcCovarMatrix See: findNonZero, countNonZero

hasNonZero(src: Mat): boolean;
src

single-channel array.

Returns

The boolean result.

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.