Skip to content

countNonZero returns wrong counts for unit8_t arrays with large dimensions (IPP) #17453

@D-Alex

Description

@D-Alex
  • OpenCV => 4.3
  • Operating System / Platform =>Mac OS Catalina + OpenCL + IPP
  • Compiler => clang
Detailed description

countNonZero is returning wrong counts for large unit8_t arrays.

The issue seems to be related to ippiCountInRange_8u_C1R which is called behind the scene returning a wrong inverse count.

Steps to reproduce
std::cout << cv::countNonZero(cv::Mat::zeros(1,524190-1,CV_8UC1));     // returns 0
std::cout << cv::countNonZero(cv::Mat::zeros(1,524190,CV_8UC1));        // returns 65536
std::cout << cv::countNonZero(cv::Mat::zeros(1,524190+1,CV_8UC1));    // returns 65536

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions