The form of OpenCV Mat data type is generally CV_<bit_depth>(S|U|F)C<number_of_channels>
, and their respective meanings are as follows:
bit_depth
: Number of bits, representing the number of pixels in the image, that is, pixel depth, such as 8bite, 16bites, 32bites, 64bites.S|U|F
: S representssigned int
signed integer. U stands forunsigned int
unsigned integer. F stands forfloat
single precision floating point type.C<number_of_channels>
: represents the number of channels of an image, such as:- channels = 1: grayscale image. is a single channel image.
- channels=3: RGB color image. is a 3 channel image.
- channels = 4: RGB image with alpha channel, representing transparency. is a 4-channel image.
For example: CV_8U represents 8 pixels, unsigned data, single channel format.
The following is a lookup table of OpenCV Mat type value:
C1 | C2 | C3 | C4 | C5 | C6 | C7 | C8 | |
CV_8U | 0 | 8 | 16 | 24 | 32 | 40 | 48 | 56 |
CV_8S | 1 | 9 | 17 | 25 | 33 | 41 | 49 | 57 |
CV_16U | 2 | 10 | 18 | 26 | 34 | 42 | 50 | 58 |
CV_16S | 3 | 11 | 19 | 27 | 35 | 43 | 51 | 59 |
CV_32S | 4 | 12 | 20 | 28 | 36 | 44 | 52 | 60 |
CV_32F | 5 | 13 | 21 | 29 | 37 | 45 | 53 | 61 |
CV_64F | 6 | 14 | 22 | 30 | 38 | 46 | 54 | 62 |
CV_16F | 7 | 15 | 23 | 31 | 39 | 47 | 55 | 63 |