Matrix Expression Comparison Operator
The docs state (emphasis mine):
Comparison:
A cmpop B
,A cmpop alpha
,alpha cmpop A
, wherecmpop
is one of :>
,>=
,==
,!=
,<=
,<
. The result of comparison is an 8-bit single channel mask whose elements are set to 255 (if the particular element or pair of elements satisfy the condition) or 0.
However, if img
is CV_8UC3
and I write this:
cv::Mat res = img != 0;
cout << res.channels() << endl;
This prints: 3
Based on the docs it seems that it should have printed 1
.
Is this a bug in the docs or in the library?