Search code examples
image-processingjpeg

How do I apply DCT to a rgb coloured image?


I am trying to understand the jpeg compression algorithm. If I have a 3-channel color image, do I have to take 3 different Discrete cosine transform (DCT) and quantize for each channel? And after taking inverse DCT, will the result be an jpeg image?


Solution

  • If I have a 3-channel color image, do I have to take 3 different Discrete cosine transform (DCT) and quantize for each channel?

    Yes, except that the color values are normally converted from RGB to YCbCr first.

    Then you have to do run-length compression and Huffman coding on the resulting values. The DCT alone negatively compresses.