I'm compiling a program with gcc's -Wall
flag. I do a comparison (with an unsigned int) on Mat::cols
and Mat::rows
at some point and get a warning about comparing signed and unsigned ints. Although it's not a big deal to cast this away, I'm curious as to what the rationale behind a Mat
that has a negative size is.
Logically, a matrix can't be any emptier than an empty matrix (with 0 rows and 0 cols), so what would a matrix with -1 rows or -1 cols mean?
There doesn't seem to be much performance difference between computations on signed and unsigned ints either.
i think because mostly int i
is used as loop counter. with uint as cols and rows many warnings will appear. Also bulding differences of dimensions would be a bit more error prone.
beside that. in my opinions OpenCv is not a good example of good design at all. there are dozens of examples of bad class design. Also the design of the generated documentation is terrible (all overloads of a function and its parameters are mixed together for example).
But it is a very comprehensive and good image processing library. and that excuses a lot :)
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