Do you know where one could find documentation for cv::Mat operators, like <, <= etc? My current doubt is to know if the < operator returns ones or ~0 values (=255 for a uint8_t image, =65535 for a uint16_t image and so on). Reading here, it is implied that the expected behaviour is the one given by the equivalent compare call. But I struggle to find a reference in the OpenCV documentation.
I tried to google:
opencv mat operator documentation
The right search term was Matrix Epressions.
From OpenCV 2 Documentation:
Comparison:
A cmpop B,A cmpop alpha,alpha cmpop A, wherecmpopis 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.
In OpenCV 3 the documentation about Matrix Expressions is scattered in the page Operations on arrays. There is a collection of Matrix Expression here, but with empty documentation! In particular to know what the < operator does, one has to check the documentation of cv::compare:
When the comparison result is true, the corresponding element of output array is set to 255. The comparison operations can be replaced with the equivalent matrix expressions:
Mat dst1 = src1 >= src2; Mat dst2 = src1 < 8; ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With