Finally, in the last part we were asked to explore color image compression through the idea of luminance and the color differences. To do this, we used the JPEG suggested quantization matrix for Luminance Y: \[Q_y=p\begin{bmatrix} 16 & 11 & 10 & 16 & 24 & 40 & 51 & 61 \\ 12 & 12 & 14 & 19 & 26 & 58 & 60 & 55 \\ 14 & 13 & 16 & 24 & 40 & 57 & 69 & 56 \\ 14 & 17 & 22 & 29 & 51 & 87 & 80 & 62 \\ 18 & 22 & 37 & 56 & 68 & 109 & 103 & 77 \\ 24 & 35 & 55 & 64 & 81 & 104 & 113 & 92 \\ 49 & 64 & 78 & 87 & 103 & 121 & 120 & 102 \\ 72 & 92 & 95 & 98 & 112 & 100 & 103 & 99 \end{bmatrix}.\] and the Color Difference Matrix for the color differences U and V: \[Q_c=p\begin{bmatrix} 17 & 18 & 24 & 47 & 99 & 99 & 99 & 99 \\ 18 & 21 & 26 & 66 & 99 & 99 & 99 & 99 \\ 24 & 26 & 56 & 99 & 99 & 99 & 99 & 99 \\ 47 & 66 & 99 & 99 & 99 & 99 & 99 & 99 \\ 99 & 99 & 99 & 99 & 99 & 99 & 99 & 99 \\ 99 & 99 & 99 & 99 & 99 & 99 & 99 & 99 \\ 99 & 99 & 99 & 99 & 99 & 99 & 99 & 99 \\ 99 & 99 & 99 & 99 & 99 & 99 & 99 & 99 \end{bmatrix}.\]
and Y, U and V are defined by:
\begin{eqnarray*} Y &=& 0.299R + 0.587G + 0.114B \\ U &=& B - Y \\ V &=& R - Y \\ \end{eqnarray*}
This YUV image is what is compressed, and then converted back to an RGB image using:
\begin{eqnarray*} R &=& V + Y \\ B &=& U + Y \\ G &=& \frac{(Y - 0.299R - 0.114B)}{0.587} \\ \end{eqnarray*}
The codes for this part can be viewed here: lumin.m lumin8.m. The images can be seen below.