Logical operations return 255 for true (Bug #2132)
Description
Logical operations on matrices (compare, >, <, ==, etc) should always return 1 for true, rather than 255. 255 is a semantically meaningless number and is only qualified by the fact that it is "not zero". By such logic, returning -134 as true would be just as useful (since by boolean logic it's also "not zero").
Having a return of 255 makes it very difficult to chain operations, especially with bit-masks or multiplications.
I motion that in a future release, all logical operations return 1 for true, and 0 for false.
Associated revisions
Merge pull request #2132 from ComFreek:patch-2
History
Updated by Kirill Kornyakov over 12 years ago
AFAIK 255 is chosen because the resulting mask can be easily visualized with highgui. But a binary image with 1 instead of 255 should be scaled beforehand.
So, do you have any practical considerations in having 1? 255 is much more convenient during debugging and IMHO makes no difference in other places.
- Priority changed from Normal to Low
- Category set to imgproc, video
Updated by Andrey Kamaev over 12 years ago
Cancelling, as this kind of change will break every program using OpenCV.
- Target version set to 2.4.3
- Status changed from Open to Cancelled
- Assignee set to Kirill Kornyakov