[英]What's the difference between cvtype values in OPENCV?
I tried a lot of constant values but I cannot find any difference between cvtype values. 我尝试了很多常量值,但我找不到cvtype值之间的任何差异。 What is it used for? 它是干什么用的? I tried values like CV_8UC4
and CV_16S
. 我尝试过像CV_8UC4
和CV_16S
这样的值。 I did not find this information in references. 我在参考文献中没有找到这些信息。
The naming sheme for the types is CV_<bit-depth>{U|S|F}C<number_of_channels>
. 类型的命名CV_<bit-depth>{U|S|F}C<number_of_channels>
是CV_<bit-depth>{U|S|F}C<number_of_channels>
。
So CV_8UC4
translates to: four channels of unsigned char and CV_16S
translates to: 1 channel of signed 2-byte integer. 因此CV_8UC4
转换为:四个无符号字符的通道, CV_16S
转换为:1个带符号的2字节整数通道。
Of course the topic is handled in the documentation. 当然,主题在文档中处理。 Here you can find more information. 在这里您可以找到更多信息。
CV_8U - 8-bit unsigned integers ( 0..255 ) CV_8U - 8位无符号整数(0..255)
CV_8S - 8-bit signed integers ( -128..127 ) CV_8S - 8位有符号整数(-128..127)
CV_16U - 16-bit unsigned integers ( 0..65535 ) CV_16U - 16位无符号整数(0..65535)
CV_16S - 16-bit signed integers ( -32768..32767 ) CV_16S - 16位有符号整数(-32768..32767)
CV_32S - 32-bit signed integers ( -2147483648..2147483647 ) CV_32S - 32位有符号整数(-2147483648..2147483647)
CV_32F - 32-bit floating-point numbers ( -FLT_MAX..FLT_MAX, INF, NAN ) CV_32F - 32位浮点数(-FLT_MAX..FLT_MAX,INF,NAN)
CV_64F - 64-bit floating-point numbers ( -DBL_MAX..DBL_MAX, INF, NAN ) CV_64F - 64位浮点数(-DBL_MAX..DBL_MAX,INF,NAN)
8-bit unsigned integer (uchar) 8位无符号整数(uchar)
8-bit signed integer (schar) 8位有符号整数(schar)
16-bit unsigned integer (ushort) 16位无符号整数(ushort)
16-bit signed integer (short) 16位有符号整数(短)
32-bit signed integer (int) 32位有符号整数(int)
32-bit floating-point number (float) 32位浮点数(浮点数)
64-bit floating-point number (double) 64位浮点数(双精度)
enum { CV_8U=0, CV_8S=1, CV_16U=2, CV_16S=3, CV_32S=4, CV_32F=5, CV_64F=6 }; 枚举{CV_8U = 0,CV_8S = 1,CV_16U = 2,CV_16S = 3,CV_32S = 4,CV_32F = 5,CV_64F = 6};
To complete the answer of Farshid PirahanSiah, 要完成Farshid PirahanSiah的答案,
A Mapping of Type to Numbers in OpenCV: in a table format OpenCV中的类型到数字的映射: 以表格格式
or in long text: 或以长文字:
Unsigned 8bits uchar 0~255 无符号8位uchar 0~255
Mat: CV_8UC1, CV_8UC2, CV_8UC3, CV_8UC4
Signed 8bits char -128~127 签名8位字符-128~127
Mat: CV_8SC1,CV_8SC2,CV_8SC3,CV_8SC4
Unsigned 16bits ushort 0~65535 无符号16位ushort 0~65535
Mat: CV_16UC1,CV_16UC2,CV_16UC3,CV_16UC4
Signed 16bits short -32768~32767 签名16位短-32768~32767
Mat: CV_16SC1,CV_16SC2,CV_16SC3,CV_16SC4
Signed 32bits int -2147483648~2147483647 有符号32位int -2147483648~2147483647
Mat: CV_32SC1,CV_32SC2,CV_32SC3,CV_32SC4
Float 32bits float -1.18*10-38~3.40*10-38 浮动32位浮点-1.18 * 10-38~3.40 * 10-38
Mat: CV_32FC1,CV_32FC2,CV_32FC3,CV_32FC4
Double 64bits double 双64位双倍
Mat: CV_64FC1,CV_64FC2,CV_64FC3,CV_64FC4
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.