Computer Vision

Image compression


Nowadays, image compression can be found everywhere. We are using computers to get more information faster than just a few years ago. If you want to look at picture on the internet, you don't want to wait some minutes for it to load. Already waiting a few seconds seems too long and decreased the interest to see this picture drastically.

There are two basic categories for compressions:

In lossless compression image data gets reduced but no image information will be lost. The image can be completely restored. This compression is mainly used in the field of medicine and astronomy (satelite images). They have a high quality but also need a lot of memory.

We use lossy compression when we want to use only few memory to store the image, for example, loading pictures on a webpage. To achive samller compressions we have to accept that we will lose some image information. These images can not be completely restored any more. As a result we get a image with lower quality than before. Still, most of the time this quality loss is not noticed by the human eye.

JPEG image compression

The Joint Photographic Experts Group developed some algorithms to compress and decompress images of a natural environment. Natural environment refers to pictures taken of nature, that is, they do not have sharp edges like a chess board does, for example. JPEG's goal for creating these algorithms were a fast compression and decompression as well as not noticable quality loss.

The basic concept of the JPEG image compression of natural grayscale images is:

  1. Split the image into 8 times 8 pixel blocks (lossless)
  2. Use the Discrete Cosine Transform (DCT) on each of those blocks (lossless)
  3. Quantization of each block (lossy)
  4. Reorder of 8 times 8 values to improve the encoding (lossless)
  5. Binary encoding using the entropy of the values (lossless)

The decompression is done in reversed order and is lossless. The reason why information is lost during the quantization is that the values will be rounded. And this process can be undone unless some extra information is additionally save. Since this contradicts the wish to use as little memory as possible and it does not influence the image quality significantly, this rounding is fine.