600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > Mat矩阵 CV_8UC1 CV_8UC2等参数详解

Mat矩阵 CV_8UC1 CV_8UC2等参数详解

时间:2021-04-10 00:39:25

相关推荐

Mat矩阵 CV_8UC1 CV_8UC2等参数详解

CV_<bit_depth>(S|U|F)C<number_of_channels>

1、bit_depth---比特数---代表8bite,16bites,32bites,64bites---举个例子吧--比如说,

如果你现在创建了一个存储--灰度图片的Mat对象,这个图像的大小为宽100,高100,那么,现在这张

灰度图片中有10000个像素点,它每一个像素点在内存空间所占的空间大小是8bite,8位--所以它对

应的就是CV_8

2、S|U|F--S--代表---signed int------有符号整形

U--代表--unsigned int-----无符号整形

F--代表--float----------------单精度浮点型

3、C<number_of_channels>----------代表一张图片的通道数,比如:

1--灰度图片--grayImg------------是单通道图像

2--RGB彩色图像------------------是3通道图像

3--带Alph通道的RGB图像------是4通道图像

以下摘自说明书:

Consequently, there is a limited fixed set of primitive data types the library can operate on. That is, array elements

should have one of the following types:

• 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)

翻译如下(使用自动翻译你们懂的)

其中去查手册CV_8U,CV_16U等是一些枚举类型如下:

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

例如:

Mat mtx(3, 3, CV_32F); // make a 3x3 floating-point matrix

Mat cmtx(10, 1, CV_64FC2); // make a 10x1 2-channel floating-point

// matrix (10-element complex vector)

Mat img(Size(1920, 1080), CV_8UC3); // make a 3-channel (color) image

// of 1920 columns and 1080 rows.

Mat grayscale(image.size(), CV_MAKETYPE(image.depth(), 1)); // make a 1-channel image of

// the same size and same

// channel type as img

参考并摘自以下博客,如转载请注明以下博客出处

/tuji-sjp/p/8858255.html

/maweifei/article/details/51221259

/zxjor91/article/details/46584871

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。