Skip to content

cv::countNonZero /documentation/ add remark about using cv::hasNonZero #25345

@nji9nji9

Description

@nji9nji9

Describe the doc issue

countNonZero in most cases is used to know if hasNonZero.
Using hasNonZero in that cases is

  • more efficient
  • semantically correct

Fix suggestion

To promote adaequate code I suggest to add to the doc of countNonZero
something like:

For determing IF there is a non-zero array element use hasNonZero.
(For multi-channel arrays do a Mat::reshape (O(1) operation) before.


Moreover add links to hasNonZero and Mat::reshape.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions