Question about the number of channels of images in opencv

Source: Internet
Author: User

When reading or reading an image, you must set the image type, number of digits, and number of channels. The number of channels (channels) is confusing:

 

Sort out the image channels in the OpenCV Chinese forum as follows:

 

(1) What is an image channel? Is it true that the number of channels in a grayscale image is 1, and that in a color image is 3? (Zhuker)

Correct!
Basically, describe a pixel. If it is grayscale, you only need a numerical value to describe it, that is, a single channel.
If a pixel has three colors of RGB, it is three channels. (Ollydbg23)

(2) What do we think of Channel 2 and Channel 4? Which one can explain this? (Feixue)

I have seen four channels. I haven't seen the two channels yet. It's probably just convenient programming. Windows bmp is sometimes A four-channel image, and R, G, and B plus A Channel A, indicating transparency. (Eralvc)

Yes. In the end, this is generally called the alpha channel, indicating transparency. (Ollydbg23)

The 4-channel is usually RGBA, which may be used in some processing.
2-channel images are not common and are usually used in program processing. For example, Fourier transformation may be used. One channel is a real number, and one channel is a virtual number, which is mainly convenient for programming.
There is also a situation where 16-bit images are originally 3 channels, but in order to reduce the data volume, the compression is 16 bits, just two channels, common formats: RGB555 or RGB565, that is to say, R occupies 5 places, G occupies 5 or 6 places, B occupies 5 places, and RGBA5551 format also exists. The old format. (Loren)

The main reason is that some cameras often use some "weird" formats.
In addition, some common cameras like YUV2, which are in the following format: YUYV. You can use four or two channels for processing.
For example, if the original format is Y1UY2V and the interpolation is Y1UV, Y2UV is two color points.
YCrCb also has similar compression conditions. (Loren)

See: http://www.opencv.org.cn/forum/viewtopic.php? F = 1 & t = 4921 & start = 0 & st = 0 & sk = t & sd = a & hilit = RGB

 

This article from the CSDN blog, reproduced please indicate the source: http://blog.csdn.net/chenyusiyuan/archive/2009/10/13/4662783.aspx

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.