How YUV Color Coding Works
Calculation of the RGB values
As a basis for determining the YUV values, the sensor must first be read out and the RGB values determined from the raw data.
Bayer sample
The pixel matrix of a CCDor CMOS sensor only records the intensity of the incident light. Only a color filter on the sensor makes each pixel sensitive to a specific color - red, green, or blue.
Camera sensors contain twice as many green pixels to ensure that the captured images match what the human eye sees. With the known arrangement of colors in the Bayer pattern filter and the transmitted raw pixel information, the full RGB color information can be interpolated for each pixel in the camera sensor.
RGB conversion
In the first step, an algorithm calculates the complete RGB values for each individual pixel. This means, for example, that even if a pixel is only sensitive to green light, the camera receives the complete RGB information for the pixel. To do this, the information from the neighboring red and blue pixels is interpolated. Of course, this is only an approximation of the real world. There are many algorithms for RGB interpretation, and the complexity and computing time of each algorithm determines the quality of the approximation.
One disadvantage of RGB conversion is that the amount of data for each pixel is inflated. If a single pixel normally has a depth of 8 bits, after conversion it has a depth of 8 bits per color (red, green, and blue) and therefore a total depth of 24 bits.
YUV encoding
In YUV coding, the RGB values are converted into an intensity component (Y), which ranges from black to white, and two further components (U and V), which encode the color.
YUV 4:4:4 scanning
The conversion from RGB to YUV is linear, takes place without loss of information, and does not depend on specific hardware such as the camera. The standard equations for converting RGB to YUV are as follows:
Y = 0.299 R + 0.587 G + 0.114 B
U = 0.493 * (B - Y)
V = 0.877 * (R - Y)
In practice, the coefficients in the equations may differ slightly due to the dynamics of the sensor used in a particular camera. Specific information about your camera can be found in the documentation.
This type of conversion is also referred to as YUV 4:4:4 scanning. With YUV 4:4:4, each pixel receives brightness and color information, while the "4:4:4" indicates the proportion of Y, U, and V components in the signal.
YUV 4:2:2 scanning
Our color cameras have an effective integrated algorithm for this RGB conversion. With all our color cameras, you can choose between an output mode that delivers the raw sensor data for each pixel or a high-quality YUV 4:2:2 signal. Some cameras also deliver RGB / BGR data.
Further information
Discover our cameras and find a detailed overview of their image formats in the documentation.