opencv DataType


The primitive types in OpenCV are unsigned char, bool, signed char, unsigned short, signed short, int, float, double. Any data type in OpenCV is defined as CV_<bit-depth>{U|S|F}C(<number_of_channels>) where U: unsigned, S:signed and F:floating point.

For example, CV_32FC2 is a 32-bit, floating-point, and 2-channels structure. and the definition of basic, one channel types are

#define CV_8U   0
#define CV_8S   1
#define CV_16U  2
#define CV_16S  3
#define CV_32S  4
#define CV_32F  5
#define CV_64F  6
#define CV_USRTYPE1 7

The other types with higher channel are produced from these by the following definition:

#define CV_MAKETYPE(depth,cn) (CV_MAT_DEPTH(depth) + (((cn)-1) << CV_CN_SHIFT))

Using these datatypes other structures can be created.