# Lossless Compression Techniques Huffman Coding Biology Essay

**Published:** **Last Edited:**

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

This is a general technique for coding symbols based on their statistical occurrence frequencies probabilities. The pixels in the image are treated as symbols. The symbols that occur more frequently are assigned a smaller number of bits, while the symbols that occur less frequently are assigned a relatively larger number of bits. Huffman code is a prefix code. This means that the (binary) code of any symbol is not the prefix of the code of any other symbol. Most image coding standards use lossy techniques in the earlier stages of compression and use Huffman coding as the final step.

## Run-Length Encoding

This is a very simple compression method used for sequential data. It is very useful in case of repetitive data. This technique replaces sequences of identical symbols (pixels) ,called runs by shorter symbols. The run length code for a gray scale image is represented by a sequence { Vi , Ri } where Vi is the intensity of pixel and Ri refers to the number of consecutive pixels with the intensity Vi as shown in the figure. If both Vi and Ri are represented by one byte, this span of 12 pixels is coded using eight bytes yielding a compression ration of 1: 5.

## LZW Coding

LZW (Lempel- Ziv - Welch) is a dictionary based coding. Dictionary based coding can be static or dynamic. In static dictionary coding, dictionary is fixed during the encoding and decoding processes. In dynamic dictionary coding, the dictionary is updated on fly. LZW is widely used in computer industry and is implemented as compress command on UNIX.

## Area Coding

Area coding is an enhanced form of run length coding, reflecting the two dimensional character of images. This is a significant advance over the other lossless methods. For coding an image it does not make too much sense to interpret it as a sequential stream, as it is in fact an array of sequences, building up a two dimensional object. The algorithms for area coding try to find rectangular regions with the same characteristics. These regions are coded in a descriptive form as an element with two points and a certain structure. This type of coding can be highly effective but it bears the problem of a nonlinear method, which cannot be implemented in hardware.

## 4.1.2 Lossy compression techniques:

## Transformation Coding

In this coding scheme, transforms such as DFT (Discrete Fourier Transform) and DCT (Discrete Cosine Transform) are used to change the pixels in the original image into frequency domain coefficients (called transform coefficients).These coefficients have several desirable properties. One is the energy compaction property that results in most of the energy of the original data being concentrated in only a few of the significant transform coefficients. This is the basis of achieving the compression. Only those few significant coefficients are selected and the remaining are discarded. The selected coefficients are considered for further quantization and entropy encoding. DCT coding has been the most common approach to transform coding. It is also adopted in the JPEG image compression standard.

## Vector Quantization

The basic idea in this technique is to develop a dictionary of fixed-size vectors, called code vectors. A vector is usually a block of pixel values. A given image is then partitioned into non-overlapping blocks (vectors) called image vectors. Then for each in the dictionary is determined and its index in the dictionary is used as the encoding of the original image vector. Thus, each image is represented by a sequence of indices that can be further entropy coded.

## Fractal Coding

The essential idea here is to decompose the image into segments by using standard image processing techniques such as color separation, edge detection, and spectrum and texture

analysis. Then each segment is looked up in a library of fractals. The library actually contains codes called iterated function system (IFS) codes, which are compact sets of numbers. Using a systematic procedure, a set of codes for a given image are determined, such that when the IFS codes are applied to a suitable set of image blocks yield an image that is a very close approximation of the original. This scheme is highly effective for compressing images that have good regularity and self-similarity.

## Block truncation coding

In this scheme, the image is divided into non overlapping blocks of pixels. For each block, threshold and reconstruction values are determined. The threshold is usually the mean of the pixel values in the block. Then a bitmap of the block is derived by replacing all pixels whose values are greater than or equal (less than) to the threshold by a 1 (0). Then for each segment (group of 1s and 0s) in the bitmap, the reconstruction value is determined. This is the average of the values of the corresponding pixels in the original block.

In this scheme, the image is analyzed to produce the components containing frequencies in well-defined bands, the sub bands. Subsequently, quantization and coding is applied to each of the bands. The advantage of this scheme is that the quantization and coding well suited for each of the sub bands can be designed separately.

## 4.2 Wavelets

## 4.2.1 What is Wavelet?

A wavelet is a kind of mathematical function used to divide a given function into different frequency components and study each component with a resolution that matches its scale. In general, a wavelet is small wave that has finite energy concentrated in time as shown in fig 2

(a) Haar (b) Daubechies

Fig 2 : Wavelet (Haar & Daubechius)

## Wavelet Families

There are many wavelets being used now a day for decomposition of signals and images. The main types/families are daubechies, biorthogonal, coiflets, symlets and dmey. The major characteristics of different types of wavelets/families are briefly described here.

## Haar wavelet

The Haar wavelet is the first known wavelet and was proposed in 1909 by Alfred Haar. The Haar wavelet is also the simplest possible wavelet. The disadvantage of the Haar wavelet is that it is not continuous and therefore not differentiable. The Haar Wavelet's mother wavelet function Ïˆ (t) can be described as

â€¦â€¦â€¦â€¦â€¦â€¦â€¦â€¦â€¦â€¦(1)

And its scaling function Ï† (t) can be described as

â€¦â€¦â€¦â€¦â€¦â€¦â€¦â€¦â€¦â€¦..(2)

## Daubechies wavelet

Named after Ingrid Daubechies, the Daubechies wavelets are a family of orthogonal wavelets defining a discrete wavelet transform and characterized by a maximal number of vanishing moments for some given support. With each wavelet type of this class, there is a scaling function (also called father wavelet) which generates an orthogonal multiresolution analysis.

The Daubechies Wavelets are compactly supported and have highest number of vanishing moments. The types are db1, db2â€¦db45. Discrete Wavelet Transform and continuous wavelet transform is possible for these. These are not symmetrical. The length of the filter is 2N. The number of vanishing moments are N. The Biorthogonal Wavelets are compactly supported wavelets for which symmetry and exact reconstruction is possible with FIR filters. The types are bior1.1, bior1.3, bior1.5, bior2.2, bior2.4 â€¦etc. Discrete and continuous wavelet transforms are possible with these.

Ingrid Daubechies, one of the brightest stars in the world of wavelet research, invented what are called compactly supported orthonormal wavelets - thus making discrete wavelet analysis practicable. The names of the Daubechies family wavelets are written dbN, where N is the order, and db the "surname" of the wavelet. The db1 wavelet, as mentioned above, is the same as Haar wavelet. Here is the wavelet functions psi of the next nine members of the family:

Fig 3 : Daubechies wavelet

These wavelets have no explicit expression except for db1, which is the Haar wavelet. A wavelet transform is the representation of a function by wavelets. The wavelets are scaled and translated copies (known as "daughter wavelets") of a finite-length or fast-decaying oscillating waveform (known as the "mother wavelet").Wavelet transforms have advantages over traditional Fourier transforms for representing functions that have discontinuities and sharp peaks. Wavelet transforms also have the advantage over the Fourier transform for accurately deconstructing and reconstructing finite, non-periodic and/or non- stationary signals.

In formal terms, this representation is a wavelet series representation of a square integrable function with respect to either a complete or orthonormal set of functions.

## Orthogonal Wavelet

Orthogonal wavelet: - An orthogonal wavelet is a wavelet where the associated wavelet transform is orthogonal. That is the inverse wavelet transform is the adjoint of the wavelet transform. If this condition is weakened you may end up with biorthogonal wavelets. Haar & Daubechies are the types of orthogonal wavelet.

In mathematics, orthogonal, as a simple adjective, not part of a longer phrase is a generalization of perpendicular. It means at right angles. Orthogonal wavelet decomposition is useful when your signal is non-stationary, meaning that its variance depends on the window of data under consideration. A wavelet basis does not have to be orthogonal. But orthogonality provides conveniences in computations in our applications.

## Bi - orthogonal wavelet

A biorthogonal wavelet is a wavelet where the associated wavelet transform is invertible but not necessarily orthogonal. Designing biorthogonal wavelets allows more degrees of freedoms than orthogonal wavelets. One additional degree of freedom is the possibility to construct symmetric wavelet functions. In the biorthogonal case, there are two scaling functions, which may generate different multiresolution analyses, and accordingly two different wavelet functions . So the numbers M, N of coefficients in the scaling sequences may differ. The scaling sequences must satisfy the following biorthogonality condition. Then the wa The Biorthogonal Wavelets are compactly supported wavelets for which symmetry and exact reconstruction is possible with FIR filters. The types are bior1.1, bior1.3, bior1.5, bior2.2, bior2.4 â€¦etc. Discrete and continuous wavelet transforms are possible with these.

velet sequences can be determined as , n=0,...,M-1 and , n=0,....,N-1.

## Symlets

The symlets are nearly symmetrical wavelets proposed by Daubechies as modifications to the db family. The properties of the two wavelet families are similar.

The Symlets Wavelets are compactly supported wavelets with highest number of vanishing moments. The types are sym1, sym2, sym3, sym4 and sym5. Discrete and continuous wavelet transform is possible with these types of wavelets. Filter length is 2N.

## ``

Fig 4 : Symlets sym4 on the Left and sym8 on the Right

## Coiflet wavelet

Coiflet is a discrete wavelet designed by Ingrid Daubechies to be more symmetrical than the Daubechies wavelet. Whereas Daubechies wavelets have N / 2 âˆ’ 1 vanishing moments, Coiflet scaling functions have N / 3 âˆ’ 1 zero moments and their wavelet functions have N / 3.

Coiflet coefficients.

Both the scaling function (low-pass filter) and the wavelet function (High-Pass Filter) must be normalized by a factor 1/âˆš2 . Below are the coefficients for the scaling functions

for C6-30. The wavelet coefficients are derived by reversing the order of the scaling function coefficients and then reversing the sign of every second one. (i.e. C6

wavelet = {âˆ’0.022140543057, 0.102859456942, 0.544281086116, âˆ’1.205718913884, 0.477859456942, 0.102859456942}) Mathematically, this looks like Bk = (âˆ’ 1)kCN âˆ’ 1 âˆ’ k where k is the coefficient index, B is a wavelet coefficient and C a scaling function coefficient. N is the wavelet index, ie 6 for C6.

Coiflets wavelets are compactly supported wavelets with highest number of vanishing moments for both psi and phi for a given support width. Discrete and continuous wavelet transform is possible with these.

Discrete Meyer wavelet is FIR based approx of the Meyer wavelet. Meyer wavelet is infinitely regular orthogonal wavelet

## Why Wavelet?

1 Applicable to any image format.

2 Less coding & decoding time.

3 Flexibility.

4 Compression quality is good.

## Advantages of Wavelets -

Real time signals are both time-limited (or space limited in the case of images) and band-limited. Time-limited signals can be efficiently represented by a basis of block functions. But block functions are not band-limited. Band limited signals on the other hand can be efficiently represented by a Fourier basis. But sines and cosines are not time-limited. Wavelets are localized in both time (space) and frequency (scale) domains. Hence it is easy to capture local features in a signal. Another advantage of a wavelet basis is that it supports multi resolution. Consider the windowed Fourier transform. The effect of the window is to localize the signal being analyzed. Because a single window is used for all frequencies, the resolution of the analysis is same at all frequencies. To capture signal discontinuities (and spikes), one needs shorter windows, or shorter basis functions. At the same time, to analyze low frequency signal components, one needs longer basis functions. With wavelet based decomposition, the window sizes vary. Thus it allows analyzing the signal at different resolution levels.

## Disadvantage of Wavelet

For images with high detail textures, lots of wavelet coefficients are found significant in the high frequency subbands. Thus, the detailed information of an image represented by the significant wavelet coefficients in the high frequency subbands demands a further decomposition. Whereas wavelet transform only decomposes the low frequency subband in the iterative manner, wavelet packet transform decomposes both the low and high frequency subbands and therefore provides a much larger family of subband decompositions.

Wavelet transform is focused on the low frequency decomposition, i.e. only the scaling coefficients are successively decomposed. As a result, wavelet transform may not be suitable for images with large regions of textures.

## 4.2.2 Types of Wavelet Transform

Wavelet transforms are classified into discrete wavelet transform (DWT) and continuous wavelet transform (CWT). The main idea about the wavelet transform is the same in both of these transform. However, they differ in the way the transformation is being carried out.

In CWT, an analyzing window is shifted along the time domain to pick up the information about the signal. This process is difficult to implement and the information that has been picked up may overlap and result in redundancy.

In DWT, signals are analyzed in discrete steps through a series of filters. This method is realizable in the computer and has the advantage of extracting the no overlapping information about the signal. Then, it continues with convolution of high pass filter with all the rows of the image, followed by a down sampling of two. This process is then repeated for all the columns of the image. If further decomposition operations are desired, acting upon the LL sub-image successively can carry them out.