Platform independent way to determine the min and max values of CV_ types

asked 2017-02-12 10:47:48 -0600

hellloooooo gravatar image

What's the best possible way to determine the min and max values that can be stored in a datatype? For example, CV_16U can store values between 0 through 65535 inclusive. I tried searching for OpenCV constants in the Hardware Abstraction Layer part of the code and could find none.

An int on one platform may not quite be an int on another. But a CV_16U on one platform will be a CV_16U on another platform that supports that type. Granted, there's obvious but tedious non-platform independent ways to do this by probing constants outside the scope of OpenCV, like INT_MAX and such, but I'm looking for a way to determine these limits with what OpenCV exposes.

edit retag flag offensive close merge delete

Comments

Does it stay the same if the platform int is different than 32 bits? I know the DataType<> assumes that it's the standard char-8, short-16, int-32. That's fairly new and not used everywhere though.

I don't have access to a non 32 int platform to test.

Tetragramm gravatar imageTetragramm ( 2017-02-12 17:15:08 -0600 )edit
Eduardo gravatar imageEduardo ( 2017-02-12 17:24:40 -0600 )edit