Much image data is encoded with the ‘RGB colour model’ which measures the presence of the three colours red, green and blue (hence RGB) in a light source.
Compression formats like JPEG use 'transform coding'
part of which involves
a 'colour space transformation',
converting images from RGB into a different colour space called
This has three components:
- The
$Y$ component represents the 'brightness' of a pixel -
$C_B$ , &$C_R$ represent the 'chrominance' (split into blue and red components).
If
- Type: Implementation
- Task: Implement
$Y'$ ,$C_B$ , &$C_R$ using the constants given as default arguments. - Bonus:
- Experiment with alternative weightings,
- Import a real image (e.g., from scikit), take a 16x16 array and apply this transform. Return both luminance values (a 16x16 array) and two 8×8 blocks of chrominance samples (sampling every other value).
- Reference implementation:
luma.brightness,luma.c_b,luma.c_r,luma.mb_to_luma_cb_cr