Pixel format: RGB YUV and Bayer


The three have been confusing to me due to terminology. To be more accurate, I use rgb24 yuv420p and bayer_rggb8 instead, which can be found in the output of “ffmpeg -pix_fmts”

  1. rgb24: one byte for each RGB component, and therefore three bytes per pixel.
  2. yuv420p: one byte luma for each pixel, and two bytes chrominance is shared by four pixels. therefore, one and half bytes for each pixel.
  3. bayer_rggb8: only one byte per pixel. In another word, only one of the RGB color is saved for each pixel.

Their strength:

  1. rgb24: the most straightforward.
  2. yuv420p: 1. save memory spaceĀ  2. in different color space of YCbCr, therefore gives a different perspective of the colors
  3. bayer_rggb8: save memory space, and it’s in the same color space as rgb24.

Camera sensors use bayer_rggb8 instead of rgb24 in order to lower the cost. For each pixel, it would need three sensors to capture all three RGB components.

Advertisements