• No results found

Other state-of-the-art Image Compression 10.8.1 Vector Quantization

RANGE = HIGH − LOW NUMBER = NUMBER − LOW

10.9 Other state-of-the-art Image Compression 10.8.1 Vector Quantization

Vector quantization, like JPEG, breaks an image into blocks (or vectors) of n X n pixels.

These blocks are then compared with a set of representative blocks. This collection of representative vectors is called a codebook. A summation of differences between the pixels in the source vector and the codebook vector is computed for each codebook entry. The codebook entry with the smallest difference summation is chosen as the representative vector.

The index of that vector is then stored to a file or transmitted (Figure 10.18).

Let's compute the compression ratio achieved using VQ. Say our original image is broken into vectors of 4 x 4 pixels. The original image is 24 bits/pixel. If we use a codebook that has 1024 vectors, we will need 10 bits to uniquely address the representative code vector. Our compression ratio for one vector (and also for the whole image) is

Compress ratio = [ 24 byte / pixel * 16 pixel ] / 10 byte = 38.4

The toughest part of vector quantization is generating codebooks. Many people instinctively think that you can just count the frequency of all vectors in a large set of representative images. The codebook could then be composed of the most frequently occurring vectors.

Although this seems like a great idea, it creates a lousy codebook. Vectors that contain much

Introduction to Image Processing and Computer Vision by LUONG CHI MAI http://www.netnam.vn/unescocourse/computervision/computer.htm

information (like edges) may not occur frequently in an image and may be left out of a codebook. This produces images of poor quality. There are many elaborate schemes for generating good codebooks. Most of them have great computational requirements.

Vector quantization comes in many flavors. One method, recursive VQ, repetitively encodes the image and the difference between the image and its approximation (the value from the codebook). Another method removes the mean of a vector before encoding.

Figure 10.18 VQ encoding.

VQ is a lossy algorithm. Artifacts introduced by VQ encoding are blockeness and color posterization. Staircased edges (jaggies) along diagonal lines can also be seen in images that have been encoded with VQ. All VQ algorithms are computationally intensive during the encoding stage, but decode relatively quickly (Figure 10.19). The decode process is merely pulling vectors out of the codebook and building the image. It is a very fast process.

Figure 10.19 VQ decoding

Introduction to Image Processing and Computer Vision by LUONG CHI MAI http://www.netnam.vn/unescocourse/computervision/computer.htm

10.8.2 Fractal Compression

Fractal compression is a radical departure from the conventional image compression techniques. The difference between it and the other techniques is much like the difference between bitmapped graphics and vector graphics. Rather than storing data for individual pixels, fractal compression stores instructions or formulas for creating the image. Because of that, images compressed with fractal compression are resolution independent. They can be scaled up to a resolution higher than the original image without the distracting artifacts associated with scaling (jaggies, smoothing from interpolation, and so on). These scalable images are well suited for graphics systems that are typically composed of devices of differing resolutions (graphics cards, printers, etc.).

Fractals are images that are composed of smaller images. Fractals were first widely introduced (or reintroduced) in the book The Fractal Geometry of Nature by Benoit Mandelbrot. Fractal compression does very well with natural scenes and claims to achieve compression ratios greater than 100.

Like vector quantization, fractal compression is asymmetrical. Although it takes a long time to compress an image, decompression is very fast. These asymmetrical methods are well suited to such applications as video on a CD-ROM where the user doesn't care about compression but does expect to see images quickly. Decompression simply reads the mathematical formulas and recreates the image.

The tough part is generating the formulas to correctly represent the image. Fractal compression assumes that every image is composed of smaller images just like them. Blue sky in an image is composed of smaller patches of blue. Tree branches can be broken into smaller branches and then twigs that all have similar structure. The compression technique tries to find as many of these relationships in an image and then describe them with mathematical formulas. This is done within regions of an image called domain regions. These domain regions are determined by using techniques such as frequency analysis, edge detection, and texture-variation analysis.

Like other lossy compression schemes, fractal compression involves a tradeoff, which is a little different from the other methods I have presented. The tradeoff is between image quality and compression time. The longer the encoder has to create the descriptive formulas, the higher the quality of the output image.

Like all other lossy compression schemes, fractal compression also introduces artifacts. These include softness and substitution of details with other details. This substitution is typically undetected in natural images.

Several patents associated with fractal compression have been granted. The techniques are proprietary and not in the public domain. If you wish to use this compression method, you must purchase a development kit from Iterated Systems Incorporated. This may be what is

Introduction to Image Processing and Computer Vision by LUONG CHI MAI http://www.netnam.vn/unescocourse/computervision/computer.htm

slowing the advancement of fractal compression into the image compression community.

10.8.3 Discrete Wavelet Transforms

Wavelet theory is a new wave in applied mathematics. This far-reaching technology has found applications in numerous sciences including acoustics, crystallography, quantum mechanics and, of course, image compression.

Discrete wavelet transforms are like DCTs in that they will decompose and image into coefficients assigned to basis functions. The DCT is limited to cosine functions that require a lot of arithmetic computations. Wavelets use a wider range of simpler functions. The result is less computational complexity with no sacrifice in image quality.

The basic compression idea is a simple one. First, the discrete wavelet transform of the image is computed. The resulting coefficients are compared with a threshold. Coefficients below the threshold are set to zero. As with the DCT-based image compression, compression comes from the information being packed into a small number of coefficients. The non-zero coefficients are then encoded using a lossless encoding scheme.

Compression ratios of up to 40 have been achieved with no noticeable difference between the original and compressed image. Beyond that, artifacts are introduced in the process. Wavelet artifacts are marked by softness, subtle random noise, and halos along edges.

10.10 Exercise

Compare the compression of the following image using (a) Huffman coding, (b) contour coding and (c) run length coding. The image has a gray level range of 0-7.

1 1 1 1 5 5 5 5 2 2 2 2 1 1 1 5 5 5 5 5 5 2 2 3 1 1 5 5 5 5 5 2 2 3 3 2 1 1 1 1 5 5 5 2 2 2 2 2 1 1 1 1 1 1 5 2 2 2 3 2 1 1 1 1 1 1 1 1 1 1 1 1