How to take a discreet photo

Discrete Cosine Transformation (DCT)


using the example of JPEG:

A common approach to lossy coding is DC transform coding. Here the data is transformed into a mathematical space that is more suitable for compression. JPEG is a standardized compression method for images and stands for Joint Photographic Expert Group, the name of the group that developed the standard. The method is lossy, but brings good compression rates. The steps involved in the JPEG process are described in a somewhat simplified manner below.



• Chroma subsampling


• Discrete cosine transformation (DCT): An image can be seen as a sequence of numerical values ​​(= color information). If you enter these numerical values ​​one after the other in a coordinate system, you get a function. These numerical values ​​can be approximated using an easily representable function. The DCT is a variation of the Fourier transform that represents any signals (any sequence of numerical values) by superimposing cosine waves with different frequencies and amplitudes. The pixel values ​​are shown as a frequency and amplitude distribution. The different frequencies of the signal become visible. Our eyes are far more sensitive to lower frequencies than to higher frequencies. By neglecting higher-frequency components, the amount of data can be reduced. Information is lost, but the eye can hardly see the differences. Instead of the numerical values ​​(pixels), only the parameters of the function series are subsequently transmitted. An image is broken down into 8x8 pixel blocks, each of which is subjected to a DCT. An 8x8 coefficient matrix is ​​calculated for each block.


• Quantization: The coefficients that are now determined are quantized in such a way that the coefficients of high-frequency image parts result in zero.


• Entropy coding: The determined values ​​(function coefficients) are put in a suitable order (so that a series of numbers with many zeros at the end is created) and then RLE-coded (run length coding). In a next step, this intermediate result is subjected to Huffman or arithmetic coding.


The reverse process, the calculation of pixels from the DCT coefficients, is called Inverse Discrete Cosine Transformation (IDCT).





see also: