lzw coding technique for image compression

15
LZW CODING TECHNIQUE FOR IMAGE LZW CODING TECHNIQUE FOR IMAGE COMPRESSION COMPRESSION RAHUL PATHAK RENJITH R CB.EN.P2AEL15018 CB.EN.P2AEL15020

Upload: renju91

Post on 17-Jan-2017

137 views

Category:

Engineering


14 download

TRANSCRIPT

Page 1: Lzw coding technique for image compression

LZW CODING TECHNIQUE FOR IMAGE COMPRESSIONLZW CODING TECHNIQUE FOR IMAGE COMPRESSION

RAHUL PATHAK RENJITH R CB.EN.P2AEL15018 CB.EN.P2AEL15020

Page 2: Lzw coding technique for image compression

CONTENTSCONTENTS

An overview of Image compressionTechniques for Image compressionAn Introduction to LZW coding techniqueMethodology (Algorithm) LZW codingAdvantages and Disadvantages of LZW codingApplications of LZW coding

Page 3: Lzw coding technique for image compression

An overview of Image compressionAn overview of Image compression Goals of compression

a) Remove redundancyb) Reduce irrelevance

c) Reduce storage required and hence the cost d) Reduced bandwidth can be used e) Reduces time to retrieve and transmit data Compression modes

1) Lossless compression Preserve all information, perfectly recoverable.

2) Lossy compression Throw away perceptually insignificant information and cannot recover all bits

Page 4: Lzw coding technique for image compression

An overview of Image compressionAn overview of Image compression

Compressed data = compress (original Data)Decompressed data = decompress(Compressed data)When original Data = decompressed data, the compression is

lossless.When original data != decompressed data, the compression is

lossy.Lossless compression is essential in applications such as text file

compression/ Medical imaging applications In video transmission, a slight loss in the transmitted video is not

noticed by the human eye.Compression ratio = original data size/compressed data size

Page 5: Lzw coding technique for image compression

Techniques for Image compressionTechniques for Image compression

?

Page 6: Lzw coding technique for image compression

An Introduction to LZW coding techniqueAn Introduction to LZW coding technique

Lempel-Ziv-Welch (LZW) coding is the foremost technique for general purpose data compression due to its simplicity and versatility.

It is invented by Abraham Lempel, Jacob Ziv, and Terry Welch It addresses spatial redundancies in an image It is an error free compression approachPrior knowledge of probability of occurrence of symbols to

be encoded is not required.Lossless compression technique

Page 7: Lzw coding technique for image compression

Why LZW coding?Why LZW coding?

For most palette color images LZW yields the highest compression efficiency without sacrificing image data. 

The GIF image file format is the de facto standard for images on the web. Most GIF files use the LZW compression.

Page 8: Lzw coding technique for image compression

AN EXAMPLE AN EXAMPLE

Consider an image of size 512*512, 8 bit image. Uncompressed TIFF Version of this image requires 286,740 bytes of disk space

Using TIFF's LZW compression option,however,the resulting file is 224,420 bytes.

The compression ratio ,C= (286740 / 224420)= 1.277For Huffman encoded representation of the same

image achieves compression ratio, C=1.077.The additional compression realized by LZW approach is

due to removal of Image's spatial redundancy.

Page 9: Lzw coding technique for image compression

Basic Principles of LZW CodingBasic Principles of LZW Coding

LZW coding assigns fixed length code words to variable length sequence of input symbols.

The coding is based on a “dictionary” or “codebook” containing the source symbols to be encoded. The coding starts with an initial dictionary, which is enlarged with the arrival of new symbol sequences.

Page 10: Lzw coding technique for image compression

Encoding a sequence of symbols using LZW CodingEncoding a sequence of symbols using LZW Coding

The encoding process is be illustrated for one line of image having the following intensity values in sequence: 32 32 34 32 34 32 32 33 32 32 32 34.

Consider the table as below:

Page 11: Lzw coding technique for image compression

Sequence: Sequence: 32 32 34 32 34 32 32 33 32 32 32 34.32 32 34 32 34 32 32 33 32 32 32 34.

Page 12: Lzw coding technique for image compression

Decoding a Lempel-Ziv encoded sequence Decoding a Lempel-Ziv encoded sequence

Page 13: Lzw coding technique for image compression

Table 27-3 provides the step-by-step details for an example input file consisting of 45 bytes, the ASCII text string: the/rain/in/Spain/falls/mainly/on/the/plain. When we say that the LZW algorithm reads the character "a" from the input file, we mean it reads the value: 01100001 (97 expressed in 8 bits), where 97 is "a" in ASCII. When we say it writes the character "a" to the encoded file, we mean it writes: 000001100001 (97 expressed in 12 bits).

Page 14: Lzw coding technique for image compression

Advantages and disadvantages of LZW codingAdvantages and disadvantages of LZW coding

Advantages: Extremely effective when there are repeated patterns in

the data that are widely spread Prior knowledge of probability of occurrence of symbols

to be encoded is not required. Simple coding technique with high compression ratio. LZW compression is fast Lossless compression techniqueDisadvantages: Creates entries in the dictionary that may never be used. LZW is a fairly old compression technique

Page 15: Lzw coding technique for image compression

Applications of LZW codingApplications of LZW coding

LZW compression can be used in a variety of file formats:

TIFF (tagged image file format )filesGIF (graphic interchange format ) filesPDF(portable document format) filesUnix Compress, gzip.Suitable for compressing text files