mirror of
https://github.com/opencv/opencv.git
synced 2026-12-02 13:16:32 -06:00
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.