For those who are interested more information on the RGB colour space to YCbCr colour space conversion during encoding.
The conversion separates the RGB image to monochrome ( luminance Y) and colour (chrominance Cr Cb) channels so that different levels of compression can be applied to the monochrome and colour components.
RGB to YCbCr Conversion is done by taking different proportions of the RGB channels as shown below
YCbCr (256 levels) can be computed directly from 8-bit RGB as follows:
Y = 0.299 R + 0.587 G + 0.114 B
Cb = - 0.1687 R - 0.3313 G + 0.5 B + 128
Cr = 0.5 R - 0.4187 G - 0.0813 B + 128
Down sampling is often applied the Cr and Cb chroma channels after conversion.
The attached image shows the original image and it's conversion to luminance and chrominance channels.
When the JPEG file is decoded the YCbCr colour space needs to be converted back to RGB as outlined below.
Before this happens the chrominance channels will have to be up sampled to match the original image size.
RGB can be computed directly from YCbCr (256 levels) as follows:
R = Y + 1.402 (Cr-128)
G = Y - 0.34414 (Cb-128) - 0.71414 (Cr-128)
B = Y + 1.772 (Cb-128)
__________________
Rob
-----------------------------------------------------
Solar powered Box Brownie Mk2
Captain Sunshine, to be such a man as he, and walk so pure between the earth and the sea.
WPF Gallery
Birdforum Gallery
Last edited by robski; 26-07-11 at 22:34.
|