Function has_non_zero

Source
pub fn has_non_zero(src: &impl ToInputArray) -> Result<bool>
Expand description

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:

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

§Parameters

  • src: single-channel array.

§See also

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