Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In OpenCV, what's the difference between CV_8U and CV_8UC1?

Tags:

types

opencv

In OpenCV, is there a difference between CV_8U and CV_8UC1? Do they both refer to an 8-bit unsigned type with one channel? If so, why are there two names? If not, what's the difference?

like image 389
t2k32316 Avatar asked Jan 27 '13 01:01

t2k32316


People also ask

What is cv_8uc1 in Opencv?

1 Answer Written. It is an 8-bit single-channel array that is primarily used to store and obtain the values of any image.

What type is CV_8U?

CV_8U is unsigned 8bit/pixel - ie a pixel can have values 0-255, this is the normal range for most image and video formats.

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 in Opencv?

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


1 Answers

You can see from this answer, they evaluate to identical types.

As for why there are two names, if you look at how the #defines are structured (again, see linked answer), a type in OpenCV has 2 parts, the depth, and the number of channels. The system is flexible enough to let you define new types with up to 512 channels. It just so happens that when you specify 1 channel, the channel component of type is set to 0 which makes the result equivalent to simply using the depth CV_8U.

like image 179
Hammer Avatar answered Sep 17 '22 23:09

Hammer