pranayr710 01bdef3cab core: add the missing CV_Bool kernel to cv::compare
Comparing two CV_Bool matrices threw "no kernel for this op/type combination" for all six
comparison operations, while the matrix/scalar overload of the same function worked.
compareByType had a case for every other depth, CV_32U, CV_64U and CV_64S included, so
CV_Bool was the only one left out.

The uchar kernel is not a correct substitute. A CV_Bool byte is not guaranteed to hold 0 or
1, since a matrix wrapping an external buffer is never converted, and comparing the raw
bytes would order 2 above 1 when both mean true. countNonZero, norm, sum and the scalar
compare overload all already read CV_Bool logically, and notKernel documents the same rule
for bitwise NOT.

scalarCompareKernel takes an isBool template parameter that normalises each operand to 0/1
before comparing. It is a compile time constant, so the existing instantiations are
unchanged.
2026-11-20 13:24:29 +05:30
2026-09-17 11:51:55 +03:00
2018-10-11 17:57:51 +00:00
2025-08-07 10:35:20 +03:00

OpenCV: Open Source Computer Vision Library

Resources

Contributing

Please read the contribution guidelines before starting work on a pull request.

Summary of the guidelines:

  • One pull request per issue;
  • Choose the right base branch;
  • Include tests and documentation;
  • Clean up "oops" commits before submitting;
  • Follow the coding style guide.

Additional Resources

Description
Languages
C++ 87.7%
C 3.1%
Python 2.9%
CMake 2%
Java 1.5%
Other 2.6%