Types of Mats and decision making

asked 2019-10-16 06:38:49 -0600

LiorA gravatar image

updated 2019-10-16 06:41:47 -0600

Hi,

I know that Mat has many different types, as detailed below.

Its puzzles my how one should decide which one of those to choose ?.

Just image quality ?

what is the correct way to convert from one to another ? (only convertTo method ?)

what is the main difference between unsigned to signed ? (besides the obvious..)

Thanks!


CV_8U - 8-bit unsigned integers ( 0..255 )

CV_8S - 8-bit signed integers ( -128..127 )

CV_16U - 16-bit unsigned integers ( 0..65535 )

CV_16S - 16-bit signed integers ( -32768..32767 )

CV_32S - 32-bit signed integers ( -2147483648..2147483647 )

CV_32F - 32-bit floating-point numbers ( -FLT_MAX..FLT_MAX, INF, NAN )

CV_64F - 64-bit floating-point numbers ( -DBL_MAX..DBL_MAX, INF, NAN )


8-bit unsigned integer (uchar)

8-bit signed integer (schar)

16-bit unsigned integer (ushort)

16-bit signed integer (short)

32-bit signed integer (int)

32-bit floating-point number (float)

64-bit floating-point number (double)

enum { CV_8U=0, CV_8S=1, CV_16U=2, CV_16S=3, CV_32S=4, CV_32F=5, CV_64F=6 };

From https://stackoverflow.com/questions/1...

edit retag flag offensive close merge delete

Comments

unless you start to design your own algorithms, you'll be bound to what the functions you use require, so usually, it's not a "decision" at all.

berak gravatar imageberak ( 2019-10-16 08:35:42 -0600 )edit
2

Im trying to implement a shadow removal algorithm/function for black/white images.

Is the 8UC3 type is enough for it ?

( Im trying the naive way - trying to create equalization around mean value of V channel in HSV colorspace)

LiorA gravatar imageLiorA ( 2019-10-16 09:00:13 -0600 )edit

Maybe it was not intended - But thank you for the overview of datatypes by the way :-)

holger gravatar imageholger ( 2019-10-16 18:44:12 -0600 )edit