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


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

https://www.cnblogs.com/tuji-sjp/p/8858255.html

https://blog.csdn.net/maweifei/article/details/51221259

https://blog.csdn.net/zxjor91/article/details/46584871

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值