YUV and RGB image formats

Source: Internet
Author: User

For Image Processing programmers, the image format must be understood. This article does not cover the compressed image format. It only describes the YUV and RGB Images.

1. Differences between RGB Images and YUV Images

The difference between an RGB image and a YUV image is that the color space coordinate system has different descriptions, just as we use Cartesian coordinates and polar coordinates to describe the equation.
The RGB color mode is a color standard in the industry) the changes of the three color channels and their overlapping to obtain various colors. RGB represents the colors of the red, green, and blue channels. in RGB color mode, the RGB model is used to allocate a value of 0 to the RGB component of each pixel in the image ~ The intensity value within the range of 255.
The coordinate space of the YUV image is HSL (hue, saturation, lightness/luminance ). H indicates the color phase, h indicates the saturation, and l indicates the brightness. The color space can be represented by a cone, as shown in:

2. Representation of images in Color Space

An image consists of pixels. When it represents a pixel point,Coordinates in pixels are different.Different image formats are formed. Such as RGB and BGR. YUV and yvu.
Since the computer is used to store or represent images, continuous coordinate values must be discretization. 8 bit space can be used to store an R value, or 6 bit space can be used to store the R value.Different Storage bitsDifferent image formats are also formed. Such as rgb24 and rgb565.
An image consists of multiple pixels. Because the storage in the computer is linear, it can be stored as (R1, G1, B1) (R2, G2, B2 )... (RN, GN, bn) can also be saved as (R1, R2 ,..., rn) (G1, G2 ,..., GN) (B1, B2 ,..., bn ).Storage sequence of coordinate values between different pixelsDifferent image formats are also formed. The former is called packed, and the latter is called P (planar ). For example, yuv420 planar and yuv420 packed. Generally, the default package format is yuv420. If the flat format is used, a P mark will be added after it, for example, uv420p.

An image consists of multiple pixels. The adjacent pixels of an image are correlated. The coordinates of a certain pixel may be used to replace the coordinates of the surrounding pixel. ThisThe representation of correlations between different pixels is different.The method also forms different image formats. For example, yuv420 and yuv422.

One of the advantages of YUV is that the sampling rate of the color channel is lower than that of Channel Y without significantly reducing the visual quality. There is a notation used to describe the sampling frequency ratio of U and V to Y. This notation is called A: B: C Notation:
• Indicates that the color channel has no downsampling.
• Represents a horizontal subsample with no vertical subsample. For every two U samples or V samples, each scan row contains four y samples.
• Indicates a horizontal subsample of and a vertical subsample.

• Indicates a horizontal subsample with no vertical subsample. For each U sample or V sample, each scan row contains four y samples.

You can remember the above format in this way,A: B indicates horizontal subsampling, and B: c Indicates vertical subsampling..

3. Specific format

For specific formats, see the following connections, which are very clear.

Http://www.cnblogs.com/azraelly/archive/2013/01/01/2841269.html

Http://blog.csdn.net/sunnylgz/article/details/7580628

Http://msdn.microsoft.com/zh-cn/library/ms867704.aspx

4. Miscellaneous

SP: SP (semi-planar) indicates that YUV is divided into two planes instead of three planes. Y data is a plane, and UV data is a plane. The data format of the UV plane is uvuvuv ....

INtersive/progressive:This term is irrelevant to the image format and is related to the scanning of video collection. Interlace refers to the interlace scan, which divides an image into the next two places. The data in the top field is the odd rows (, 5, 7 ...), the data in the bottom field is an even number of rows (2, 4, 6, 8...) of the entire image ...). The two pieces are combined to form a complete image. Progressive refers to a row-by-row scan. Each line of an image is discharged in sequence.

Top sampling/bottom sampling:Sampling is a sample that collects analog signals. Sampling is a continuous signal of time and amplitude. Under the action of a sampling pulse, the signal is converted into a discrete signal of time and amplitude. Therefore, sampling is also called the waveform discretization process. The premise of the general nequest sampling theorem is that the frequency is limited by the band-limited Signal of (0, F.
Sampling usually refers to downsampling, that is, extracting signals. In fact, both the upper sampling and lower sampling are performed on the digital signal. The sampling rate of the Secondary Sampling is compared with the sampling rate obtained from the original digital signal (for example, from the analog signal sampling, higher than the original signal is called the upper sampling, and smaller than is called the lower sampling. The essence of sampling is interpolation or interpolation.
The upper sampling is the inverse process of the lower sampling, also known as upsampling or interpolating ). The application of incremental sampling in frequency division multiplexing is a good example.

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.