Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between cvtype values in OPENCV?

Tags:

opencv

I tried a lot of constant values but I cannot find any difference between cvtype values. What is it used for? I tried values like CV_8UC4 and CV_16S. I did not find this information in references.

like image 814
Beto Caldas Avatar asked Nov 17 '12 07:11

Beto Caldas


People also ask

What does 8uc3 mean?

so CV_8UC3 is an 8-bit unsigned integer matrix/image with 3 channels. Although it is most common that this means an RGB (or actually BGR) image, it does not mandate it. It simply means that there are three channels, and how you use them is up to you and your application. Follow this answer to receive notifications.

What is CV_16S?

So CV_8UC4 translates to: four channels of unsigned char and CV_16S translates to: 1 channel of signed 2-byte integer.


2 Answers

The naming sheme for the types is 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.

Of course the topic is handled in the documentation. Here you can find more information.

like image 117
AD-530 Avatar answered Sep 22 '22 19:09

AD-530


CV_8U - 8-bit unsigned integers ( 0..255 )

CV_8S - 8-bit signed integers ( -128..127 )

CV_16U - 16-bit unsigned integers ( 0..65535 )

CV_16S - 16-bit signed integers ( -32768..32767 )

CV_32S - 32-bit signed integers ( -2147483648..2147483647 )

CV_32F - 32-bit floating-point numbers ( -FLT_MAX..FLT_MAX, INF, NAN )

CV_64F - 64-bit floating-point numbers ( -DBL_MAX..DBL_MAX, INF, NAN )


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)

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

like image 41
Farshid PirahanSiah Avatar answered Sep 20 '22 19:09

Farshid PirahanSiah