0% found this document useful (0 votes)
3 views6 pages

lec 24

The document discusses Lempel-Ziv-Welch (LZW) coding, an error-free image compression technique that addresses spatial redundancies. It explains the encoding process, which involves searching a dictionary for concatenated pixel sequences and updating it accordingly. The document also provides an example of encoding data using a 512-word dictionary, demonstrating the compression ratio and redundancy achieved.

Uploaded by

Sahil Atri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views6 pages

lec 24

The document discusses Lempel-Ziv-Welch (LZW) coding, an error-free image compression technique that addresses spatial redundancies. It explains the encoding process, which involves searching a dictionary for concatenated pixel sequences and updating it accordingly. The document also provides an example of encoding data using a 512-word dictionary, demonstrating the compression ratio and redundancy achieved.

Uploaded by

Sahil Atri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Digital Image Processing (CS-323)

Lecture-24
Dr. Ajay Kumar Mallick
Department of Computer Science and Engineering
NIT Hamirpur, India

Dr. Ajay Kumar Mallick,


NIT Hamirpur
Outline

▪ Topics to Learn

▪ Image Compression
▪ LZW Coding

Dr. Ajay Kumar Mallick,


NIT Hamirpur
LZW Coding

▪ We consider an error-free compression approach that also addresses


spatial redundancies in an image.

▪ The technique, called Lempel-Ziv-Welch (LZW) coding, assigns fixed-


length code words to variable length sequences of source symbols.
▪ LZW compression has been integrated into a variety of mainstream
imaging file formats, including GIF, TIFF, and PDF
Dr. Ajay Kumar Mallick,
NIT Hamirpur
LZW Coding: Steps of Encoding

▪ The image is encoded by processing its pixels in left-right, top to buttom.

▪ Each successive intensity value is concatenated with a variable- referred as


“ Current Recognized Sequence”.

▪ The dictionary is searched for each concatenated sequence and if found, is


replaced by the newly concatenated and recognized sequence. No outputs codes
are generated, nor is the dictionary altered.

▪ If the concatenated sequence is not found, the address of the currently


recognized sequence is output as the next encoded value, the concatenated but
recognized sequence is added to the dictionary, and the currently recognized
sequence is initialized to the current pixel value. Dr. Ajay Kumar Mallick,
NIT Hamirpur
LZW Coding

▪ A 512-word dictionary with the following starting content is assumed


▪ We encode the data with 9 bits and the dictionary length is 512

Dr. Ajay Kumar Mallick,


NIT Hamirpur
LZW Coding
Currently Pixel Being Encoded Dictionary Dictionary 39 39 126 126
Recognised Processed Output Location Entry
Sequence 39 39 126 126
(Code Word)
- 39
39 39 39 256 39-39 39 39 126 126
39 126 39 257 39-126
126 126 126 258 126-126 39 39 126 126
126 39 126 259 126-39
39 39 The encoded data is (Encoded
39-39 126 256 260 39-39-126 Output)is:
126 126 39, 39, 126, 126, 256, 258, 260, 259,
257, 126
126-126 39 258 261 126-126-39
39 39 Thus, total 10 elements each of 9 bits
39-39 126 take 90 bits to represent 128 bit data
39-39-126 126 260 262 39-39-126-126 (16*8bits)
Compression ratio C = 128:90 =1.42:1
126 39 Redundancy = 1 -
𝟏
= 30%
𝟏.𝟒𝟐
126-39 39 259 263 126-39-39 Dr. Ajay Kumar Mallick,
39 126
NIT Hamirpur
39-126 126 257 264 39-126-126
126 126

You might also like