235
(c) Scott E Umbaugh, SIUE 2005 (c) Scott E Umbaugh, SIUE 2005 1 Chapter 10 Chapter 10 Image Compression Image Compression

Chapter 10 Image Compression

  • Upload
    payton

  • View
    36

  • Download
    2

Embed Size (px)

DESCRIPTION

Chapter 10 Image Compression. Introduction and Overview The field of image compression continues to grow at a rapid pace As we look to the future, the need to store and transmit images will only continue to increase faster than the available capability to process all the data. - PowerPoint PPT Presentation

Citation preview

Page 1: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 11

Chapter 10Chapter 10Image CompressionImage Compression

Page 2: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 22

Introduction and OverviewIntroduction and Overview

The field of image compression continues The field of image compression continues to grow at a rapid pace to grow at a rapid pace

As we look to the future, the need to store As we look to the future, the need to store and transmit images will only continue to and transmit images will only continue to increase faster than the available increase faster than the available capability to process all the datacapability to process all the data

Page 3: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 33

Applications that require image Applications that require image compression are many and varied such compression are many and varied such as:as:

1.1. Internet, Internet, 2.2. Businesses, Businesses, 3.3. Multimedia, Multimedia, 4.4. Satellite imaging, Satellite imaging, 5.5. Medical imaging Medical imaging

Page 4: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 44

Compression algorithm development Compression algorithm development starts with applications to two-dimensional starts with applications to two-dimensional (2-D) still images (2-D) still images

After the 2-D methods are developed, they After the 2-D methods are developed, they are often extended to video (motion are often extended to video (motion imaging)imaging)

However, we will focus on image However, we will focus on image compression of single frames of image compression of single frames of image data data

Page 5: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 55

Image compressionImage compression involves reducing the involves reducing the size of image data files, while size of image data files, while retaining retaining necessary information necessary information

Retaining necessary information depends Retaining necessary information depends upon the applicationupon the application

Image segmentation methods, which are Image segmentation methods, which are primarily a data reduction process, can be primarily a data reduction process, can be used for compressionused for compression

Page 6: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 66

The reduced file created by the The reduced file created by the compression process is called the compression process is called the compressed filecompressed file and is used to reconstruct and is used to reconstruct the image, resulting in the the image, resulting in the decompressed decompressed imageimage

The original image, before any The original image, before any compression is performed, is called the compression is performed, is called the uncompresseduncompressed image fileimage file

The ratio of the original, uncompressed The ratio of the original, uncompressed image file and the compressed file is image file and the compressed file is referred to as the referred to as the compression ratiocompression ratio

Page 7: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 77

The compression ratio is denoted by:The compression ratio is denoted by:

Page 8: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 88

The reduction in file size is necessary to The reduction in file size is necessary to meet the bandwidth requirements for meet the bandwidth requirements for many transmission systems, and for the many transmission systems, and for the storage requirements in computer storage requirements in computer databasesdatabases

Also, the amount of data required for Also, the amount of data required for digital images is enormousdigital images is enormous

Page 9: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 99

This number is based on the actual This number is based on the actual transmission rate being the maximum, transmission rate being the maximum, which is typically not the case due to which is typically not the case due to Internet traffic, overhead bits and Internet traffic, overhead bits and transmission errorstransmission errors

Page 10: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 1010

Additionally, considering that a web page Additionally, considering that a web page might contain more than one of these might contain more than one of these images, the time it takes is simply too longimages, the time it takes is simply too long

For high quality images the required For high quality images the required

resolution can be much higher than the resolution can be much higher than the previous exampleprevious example

Page 11: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 1111

Example 10.1.5 applies maximum data rate to Example 10.1.4

Page 12: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 1212

Now, consider the transmission of video Now, consider the transmission of video images, where we need multiple frames images, where we need multiple frames per second per second

If we consider just one second of video If we consider just one second of video data that has been digitized at 640x480 data that has been digitized at 640x480 pixels per frame, and requiring 15 frames pixels per frame, and requiring 15 frames per second for interlaced video, then:per second for interlaced video, then:

Page 13: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 1313

Waiting 35 seconds for one second’s Waiting 35 seconds for one second’s worth of video is not exactly real time! worth of video is not exactly real time!

Even attempting to transmit Even attempting to transmit uncompressed video over the highest uncompressed video over the highest speed Internet connection is impractical speed Internet connection is impractical

For example: The Japanese Advanced For example: The Japanese Advanced Earth Observing Satellite (ADEOS) Earth Observing Satellite (ADEOS) transmits image data at the rate of 120 transmits image data at the rate of 120 MbpsMbps

Page 14: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 1414

Applications requiring high speed Applications requiring high speed connections such as high definition connections such as high definition television, real-time teleconferencing, and television, real-time teleconferencing, and transmission of multiband high resolution transmission of multiband high resolution satellite images, leads us to the conclusion satellite images, leads us to the conclusion that that image compression is not only image compression is not only desirable but necessessarydesirable but necessessary

Key to a successful compression Key to a successful compression schemescheme is is retaining necessary retaining necessary information information

Page 15: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 1515

To understand “To understand “retaining necessary retaining necessary informationinformation”, we must differentiate ”, we must differentiate betweenbetween data data and and information information

1.1. DataData::• For digital imagesFor digital images, data, data refers to the refers to the

pixel gray level values that correspond to pixel gray level values that correspond to the brightness of a pixel at a point in the brightness of a pixel at a point in spacespace

• Data are used to convey information, Data are used to convey information, much like the way the alphabet is used to much like the way the alphabet is used to convey information via words convey information via words

Page 16: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 1616

2.2. Information:Information:

• Information is an interpretation of the Information is an interpretation of the data in a meaningful way data in a meaningful way

• Information is an elusive concept; it can Information is an elusive concept; it can be application specificbe application specific

Page 17: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 1717

There are two primary types of image There are two primary types of image compression methods:compression methods:

1.1. Lossless compression methods:Lossless compression methods:• Allows for the exact recreation of the original Allows for the exact recreation of the original

image data, and can compress complex image data, and can compress complex images to a maximum 1/2 to 1/3 the original images to a maximum 1/2 to 1/3 the original size – 2:1 to 3:1 compression ratiossize – 2:1 to 3:1 compression ratios

• Preserves the data Preserves the data exactlyexactly

Page 18: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 1818

2.2. LossyLossy compression methods:compression methods:

• Data loss, original image cannot be re-Data loss, original image cannot be re-created exactlycreated exactly

• Can compress complex images 10:1 to Can compress complex images 10:1 to 50:1 and retain high quality, and 100 to 50:1 and retain high quality, and 100 to 200 times for lower quality, but 200 times for lower quality, but acceptable, imagesacceptable, images

Page 19: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 1919

Compression algorithms are developed Compression algorithms are developed by taking advantage of the redundancy by taking advantage of the redundancy that is inherent in image datathat is inherent in image data

Four primary types of redundancy that Four primary types of redundancy that can be found in images are: can be found in images are:

1.1. Coding Coding 2.2. InterpixelInterpixel3.3. Interband Interband 4.4. Psychovisual redundancyPsychovisual redundancy

Page 20: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 2020

1.1. Coding redundancyCoding redundancy Occurs when the data used to represent Occurs when the data used to represent

the image is not utilized in an optimal the image is not utilized in an optimal manner manner

2.2. Interpixel redundancyInterpixel redundancy Occurs because adjacent pixels tend to Occurs because adjacent pixels tend to

be highly correlated, in most images the be highly correlated, in most images the brightness levels do not change rapidly, brightness levels do not change rapidly, but change graduallybut change gradually

Page 21: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 2121

3.3. Interband redundancyInterband redundancy Occurs in color images due to the Occurs in color images due to the

correlation between bands within an correlation between bands within an image – if we extract the red, green and image – if we extract the red, green and blue bands they look similarblue bands they look similar

4.4. Psychovisual redundancyPsychovisual redundancy Some information is more important to Some information is more important to

the human visual system than other the human visual system than other types of information types of information

Page 22: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 2222

The key in image compression algorithm The key in image compression algorithm development is to determine the minimal development is to determine the minimal data required to retain the necessary data required to retain the necessary information information

The compression is achieved by taking The compression is achieved by taking advantage of the redundancy that exists in advantage of the redundancy that exists in images images

If the redundancies are removed prior to If the redundancies are removed prior to compression, for example with a compression, for example with a decorrelation process, a more effective decorrelation process, a more effective compression can be achieved compression can be achieved

Page 23: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 2323

To help determine which information can To help determine which information can be removed and which information is be removed and which information is important, the important, the image fidelity criteriaimage fidelity criteria are are usedused

These measures provide metrics for These measures provide metrics for determining image quality determining image quality

It should be noted that the information It should be noted that the information required is application specific, and that, required is application specific, and that, with lossless schemes, there is no need with lossless schemes, there is no need for a fidelity criteria for a fidelity criteria

Page 24: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 2424

Most of the compressed images shown in Most of the compressed images shown in this chapter are generated with CVIPtools, this chapter are generated with CVIPtools, which consists of code that has been which consists of code that has been developed for educational and research developed for educational and research purposespurposes

The compressed images shown are not The compressed images shown are not necessarily representative of the best necessarily representative of the best commercial applications that use the commercial applications that use the techniques described, because the techniques described, because the commercial compression algorithms are commercial compression algorithms are often often combinationscombinations of the techniques of the techniques described herein described herein

Page 25: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 2525

Compression System ModelCompression System Model

• The compression system model consists The compression system model consists of two parts: of two parts:

1.1. The compressor The compressor 2.2. The decompressorThe decompressor

• The The compressor compressor consists of a consists of a preprocessing stage and encoding stage, preprocessing stage and encoding stage, whereas the whereas the decompressor decompressor consists of a consists of a decoding stage followed by a decoding stage followed by a postprocessing stagepostprocessing stage

Page 26: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 2626

Decompressed image

Page 27: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 2727

• Before encoding, preprocessing is Before encoding, preprocessing is performed to prepare the image for the performed to prepare the image for the encoding process, and consists of any encoding process, and consists of any number of operations that are application number of operations that are application specific specific

• After the compressed file has been After the compressed file has been decoded, postprocessing can be decoded, postprocessing can be performed to eliminate some of the performed to eliminate some of the potentially undesirable artifacts brought potentially undesirable artifacts brought about by the compression process about by the compression process

Page 28: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 2828

• The compressor can be broken into The compressor can be broken into following stages:following stages:

1.1. Data reductionData reduction: Image data can be : Image data can be reduced by gray level and/or spatial reduced by gray level and/or spatial quantization, or can undergo any desired quantization, or can undergo any desired image improvement (for example, noise image improvement (for example, noise removal) process removal) process

2.2. MappingMapping: Involves mapping the original : Involves mapping the original image data into another mathematical image data into another mathematical space where it is easier to compress the space where it is easier to compress the data data

Page 29: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 2929

3.3. QuantizationQuantization: Involves taking potentially : Involves taking potentially continuous data from the mapping stage continuous data from the mapping stage and putting it in discrete form and putting it in discrete form

4.4. CodingCoding: Involves mapping the discrete : Involves mapping the discrete data from the quantizer onto a code in an data from the quantizer onto a code in an optimal manner optimal manner

• A compression algorithm may consist of A compression algorithm may consist of all the stages, or it may consist of only all the stages, or it may consist of only one or two of the stages one or two of the stages

Page 30: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 3030

Page 31: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 3131

• The decompressor can be broken down The decompressor can be broken down into following stages:into following stages:

1.1. DecodingDecoding: Takes the compressed file : Takes the compressed file and reverses the original coding by and reverses the original coding by mapping the codes to the original, mapping the codes to the original, quantized values quantized values

2.2. Inverse mappingInverse mapping: Involves reversing the : Involves reversing the original mapping process original mapping process

Page 32: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 3232

3.3. PostprocessingPostprocessing: Involves enhancing the : Involves enhancing the look of the final image look of the final image

• This may be done to reverse any This may be done to reverse any preprocessing, for example, enlarging an preprocessing, for example, enlarging an image that was shrunk in the data image that was shrunk in the data reduction processreduction process

• In other cases the postprocessing may In other cases the postprocessing may be used to simply enhance the image to be used to simply enhance the image to ameliorate any artifacts from the ameliorate any artifacts from the compression process itselfcompression process itself

Page 33: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 3333

Decompressed image

Page 34: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 3434

• The development of a compression The development of a compression algorithm is highly application specific algorithm is highly application specific

• Preprocessing stage of compression Preprocessing stage of compression consists of processes such as consists of processes such as enhancement, noise removal, or enhancement, noise removal, or quantization are applied quantization are applied

• The goal of preprocessing is to prepare The goal of preprocessing is to prepare the image for the encoding process by the image for the encoding process by eliminating any irrelevant information, eliminating any irrelevant information, where where irrelevantirrelevant is defined by the is defined by the applicationapplication

Page 35: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 3535

• For example, many images that are for For example, many images that are for viewing purposes only can be viewing purposes only can be preprocessed by eliminating the lower bit preprocessed by eliminating the lower bit planes, without losing any useful planes, without losing any useful information information

Page 36: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 3636

Figure 10.1.4 Bit plane images

a) Original image

b) Bit plane 7, the most significant bit

c) Bit plane 6

Page 37: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 3737

Figure 10.1.4 Bit plane images (Contd)

d) Bit plane 5

e) Bit plane 4

f) Bit plane 3

Page 38: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 3838

Figure 10.1.4 Bit plane images (Contd)

g) Bit plane 2

h) Bit plane 1

i) Bit plane 0, the least significant bit

Page 39: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 3939

• The mapping process is important The mapping process is important because image data tends to be highly because image data tends to be highly correlated correlated

• Specifically, if the value of one pixel is Specifically, if the value of one pixel is known, it is highly likely that the adjacent known, it is highly likely that the adjacent pixel value is similarpixel value is similar

• By finding a mapping equation that By finding a mapping equation that decorrelates the data this type of data decorrelates the data this type of data redundancy can be removed redundancy can be removed

Page 40: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 4040

• Differential coding:Differential coding: Method of reducing Method of reducing data redundancy, by finding the difference data redundancy, by finding the difference between adjacent pixels and encoding between adjacent pixels and encoding those values those values

• The The principal components transformprincipal components transform can can also be used, which provides a also be used, which provides a theoretically optimal decorrelationtheoretically optimal decorrelation

• Color transformsColor transforms are used to decorrelate are used to decorrelate data between image bands data between image bands

Page 41: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 4141

Figure -5.6.1 Principal Components Transform (PCT)

a) Red band of a color image b) Green band c) Blue band

d) Principal component band 1 e) Principal component band 2 f) Principal component band 3

Page 42: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 4242

• As the spectral domain can also be used As the spectral domain can also be used for image compression, so the first stage for image compression, so the first stage may include mapping into the frequency or may include mapping into the frequency or sequency domain where the energy in the sequency domain where the energy in the image is compacted into primarily the image is compacted into primarily the lower frequency/sequency componentslower frequency/sequency components

• These methods are all These methods are all reversiblereversible, that is , that is information preserving, although all information preserving, although all mapping methods are not reversiblemapping methods are not reversible

Page 43: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 4343

• QuantizationQuantization may be necessary to convert may be necessary to convert the data into digital form (BYTE data type), the data into digital form (BYTE data type), depending on the mapping equation used depending on the mapping equation used

• This is because many of these mapping This is because many of these mapping methods will result in floating point data methods will result in floating point data which requires multiple bytes for which requires multiple bytes for representation which is not very efficient, if representation which is not very efficient, if the goal is data reductionthe goal is data reduction

Page 44: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 4444

• Quantization can be performed in the Quantization can be performed in the following ways:following ways:

1.1. Uniform quantization:Uniform quantization: In it, all the quanta, In it, all the quanta, or subdivisions into which the range is or subdivisions into which the range is divided, are of equal width divided, are of equal width

2.2. Nonuniform quantization:Nonuniform quantization: In it the In it the quantization bins are not all of equal widthquantization bins are not all of equal width

Page 45: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 4545

Page 46: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 4646

• Often, nonuniform quantization bins are Often, nonuniform quantization bins are designed to take advantage of the designed to take advantage of the response of the human visual systemresponse of the human visual system

• In the spectral domain, the higher In the spectral domain, the higher frequencies may also be quantized with frequencies may also be quantized with wider bins because we are more sensitive wider bins because we are more sensitive to lower and midrange spatial frequencies to lower and midrange spatial frequencies and most images have little energy at high and most images have little energy at high frequencies frequencies

Page 47: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 4747

• The concept of nonuniform quantization The concept of nonuniform quantization bin sizes is also described as a bin sizes is also described as a variable bit variable bit raterate, since the wider quantization bins , since the wider quantization bins imply fewer bits to encode, while the imply fewer bits to encode, while the smaller bins need more bitssmaller bins need more bits

• It is important to note that the quantization It is important to note that the quantization

process is not reversible, so it is not in the process is not reversible, so it is not in the decompression model and also some decompression model and also some information may be lost during information may be lost during quantizationquantization

Page 48: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 4848

• The coder in the coding stage provides a The coder in the coding stage provides a one-to-one mapping, each input is one-to-one mapping, each input is mapped to a unique output by the coder, mapped to a unique output by the coder, so it is a reversible process so it is a reversible process

• The code can be an The code can be an equal length code,equal length code, where all the code words are the same where all the code words are the same size, or an size, or an unequal length codeunequal length code with with variable length code words variable length code words

Page 49: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 4949

• In most cases, an unequal length code is In most cases, an unequal length code is the most efficient for data compression, the most efficient for data compression, but requires more overhead in the coding but requires more overhead in the coding and decoding stages and decoding stages

Page 50: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 5050

LOSSLESS COMPRESSION LOSSLESS COMPRESSION METHODSMETHODS

No loss of data, decompressed image No loss of data, decompressed image exactly same as uncompressed imageexactly same as uncompressed image

Medical images or any images used in Medical images or any images used in courtscourts

Lossless compression methods typically Lossless compression methods typically provide about a 10% reduction in file size provide about a 10% reduction in file size for complex imagesfor complex images

Page 51: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 5151

Lossless compression methods can Lossless compression methods can provide substantial compression for simple provide substantial compression for simple imagesimages

However, lossless compression However, lossless compression techniques may be used for both techniques may be used for both preprocessing and postprocessing in preprocessing and postprocessing in image compression algorithms to obtain image compression algorithms to obtain the extra 10% compression the extra 10% compression

Page 52: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 5252

The underlying theory for lossless The underlying theory for lossless compression (also called compression (also called data compactiondata compaction) ) comes from the area of communications comes from the area of communications and information theory, with a and information theory, with a mathematical basis in probability theorymathematical basis in probability theory

One of the most important concepts used One of the most important concepts used is the idea of is the idea of information contentinformation content and and randomness in datarandomness in data

Page 53: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 5353

Information theoryInformation theory defines information defines information based on the probability of an event, based on the probability of an event, knowledge of an unlikely event has more knowledge of an unlikely event has more information than knowledge of a likely information than knowledge of a likely eventevent

For example:For example:• The earth will continue to revolve around the The earth will continue to revolve around the

sun; little information, 100% probabilitysun; little information, 100% probability• An earthquake will occur tomorrow; more info. An earthquake will occur tomorrow; more info.

Less than 100% probabilityLess than 100% probability• A matter transporter will be invented in the next A matter transporter will be invented in the next

10 years; highly unlikely – low probability, high 10 years; highly unlikely – low probability, high information contentinformation content

Page 54: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 5454

This perspective on information is theThis perspective on information is the information theoretic definitioninformation theoretic definition and should and should not be confused with our working definition not be confused with our working definition that requires information in images to be that requires information in images to be useful, not simply novel useful, not simply novel

EntropyEntropy is the measurement of the is the measurement of the average information in an imageaverage information in an image

Page 55: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 5555

The entropy for an The entropy for an N x NN x N image can be image can be calculated by this equation:calculated by this equation:

Page 56: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 5656

This measure provides us with a This measure provides us with a theoretical minimum for the average theoretical minimum for the average number of bits per pixel that could be used number of bits per pixel that could be used to code the imageto code the image

It can also be used as a metric for judging It can also be used as a metric for judging the success of a coding scheme, as it is the success of a coding scheme, as it is theoretically optimaltheoretically optimal

Page 57: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 5757

Page 58: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 5858

Page 59: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 5959

The two preceding examples (10.2.1 and The two preceding examples (10.2.1 and 10.2.2) illustrate the range of the entropy:10.2.2) illustrate the range of the entropy:

The examples also illustrate the The examples also illustrate the information theory perspective regarding information theory perspective regarding information and randomness information and randomness

The more randomness that exists in an The more randomness that exists in an image, the more evenly distributed the image, the more evenly distributed the gray levels, and more bits per pixel are gray levels, and more bits per pixel are required to represent the data required to represent the data

Page 60: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 6060

Figure 10.2-1 Entropy

c) Image after binary threshold,

entropy = 0.976 bpp a) Original image, entropy = 7.032 bpp

b) Image after local histogram equalization, block size 4, entropy = 4.348 bpp

Page 61: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 6161

f) Circle with a radius of 32, and a linear blur radius of 64, entropy = 2.030 bpp

d) Circle with a radius of 32, entropy = 0.283 bpp

e) Circle with a radius of 64, entropy = 0.716 bpp

Figure 10.2-1 Entropy (contd)

Page 62: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 6262

Figure 10.2.1 depicts that a minimum Figure 10.2.1 depicts that a minimum overall file size will be achieved if a overall file size will be achieved if a smaller number of bits is used to code the smaller number of bits is used to code the most frequent gray levels most frequent gray levels

Average number of bits per pixel (Average number of bits per pixel (LLength) ength) in a coder can be measured by the in a coder can be measured by the following equation:following equation:

Page 63: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 6363

Huffman CodingHuffman Coding

• The Huffman code, developed by D. The Huffman code, developed by D. Huffman in 1952, is a Huffman in 1952, is a minimum length minimum length code code

• This means that given the statistical This means that given the statistical distribution of the gray levels (the distribution of the gray levels (the histogram), the Huffman algorithm will histogram), the Huffman algorithm will generate a code that is as close as generate a code that is as close as possible to the possible to the minimum bound, the minimum bound, the entropy entropy

Page 64: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 6464

• The method results in an The method results in an unequal unequal (or(or variablevariable)) length code length code, where the size of , where the size of the code words can varythe code words can vary

• For complex images, Huffman coding For complex images, Huffman coding alone will typically reduce the file by 10% alone will typically reduce the file by 10% to 50% (1.1:1 to 1.5:1), but this ratio can to 50% (1.1:1 to 1.5:1), but this ratio can be improved to 2:1 or 3:1 by be improved to 2:1 or 3:1 by preprocessing for irrelevant information preprocessing for irrelevant information removal removal

Page 65: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 6565

• The Huffman algorithm can be described The Huffman algorithm can be described in five steps:in five steps:

1.1. Find the gray level probabilities for the image by Find the gray level probabilities for the image by finding the histogramfinding the histogram

2.2. Order the input probabilities (histogram Order the input probabilities (histogram magnitudes) from smallest to largestmagnitudes) from smallest to largest

3.3. Combine the smallest two by additionCombine the smallest two by addition4.4. GOTO step 2, until only two probabilities are leftGOTO step 2, until only two probabilities are left5.5. By working backward along the tree, generate By working backward along the tree, generate

code by alternating assignment of 0 and 1code by alternating assignment of 0 and 1

Page 66: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 6666

Page 67: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 6767

Page 68: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 6868

Page 69: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 6969

Page 70: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 7070

Page 71: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 7171

Page 72: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 7272

• In the example, we observe a 2.0 : 1.9 In the example, we observe a 2.0 : 1.9 compression, which is about a 1.05 compression, which is about a 1.05 compression ratio, providing about 5% compression ratio, providing about 5% compressioncompression

• From the example we can see that the From the example we can see that the Huffman code is highly dependent on the Huffman code is highly dependent on the histogram, so any preprocessing to histogram, so any preprocessing to simplify the histogram will help improve simplify the histogram will help improve the compression ratiothe compression ratio

Page 73: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 7373

Run-Length CodingRun-Length Coding

• Run-length coding (RLC) works by Run-length coding (RLC) works by counting adjacent pixels with the same counting adjacent pixels with the same gray level value called the gray level value called the run-length, run-length, which is then encoded and storedwhich is then encoded and stored

• RLC works best for binary, two-valued, RLC works best for binary, two-valued,

imagesimages

Page 74: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 7474

• RLC can also work with complex images RLC can also work with complex images that have been preprocessed by that have been preprocessed by thresholding to reduce the number of gray thresholding to reduce the number of gray levels to twolevels to two

• RLC can be implemented in various ways, RLC can be implemented in various ways, but the first step is to define the required but the first step is to define the required parametersparameters

• Horizontal RLC (counting along the rows) Horizontal RLC (counting along the rows) or vertical RLC (counting along the or vertical RLC (counting along the columns) can be used columns) can be used

Page 75: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 7575

• In basic horizontal RLC, the number of bits In basic horizontal RLC, the number of bits used for the encoding depends on the used for the encoding depends on the number of pixels in a row number of pixels in a row

• If the row has 2If the row has 2nn pixels, then the required pixels, then the required number of bits is number of bits is nn, so that a run that is the , so that a run that is the length of the entire row can be encoded length of the entire row can be encoded

Page 76: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 7676

• The next step is to define a convention for The next step is to define a convention for the first RLC number in a row – does it the first RLC number in a row – does it represent a run of 0's or 1's?represent a run of 0's or 1's?

Page 77: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 7777

Page 78: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 7878

Page 79: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 7979

• Bitplane-RLCBitplane-RLC : A technique which involves : A technique which involves extension of basic RLC method to gray extension of basic RLC method to gray level images, by applying basic RLC to level images, by applying basic RLC to each bit-plane independently each bit-plane independently

• For each binary digit in the gray level For each binary digit in the gray level value, an image plane is created, and this value, an image plane is created, and this image plane (a string of 0's and 1's) is image plane (a string of 0's and 1's) is then encoded using RLCthen encoded using RLC

Page 80: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 8080

Page 81: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 8181

• Typical compression ratios of 0.5 to 1.2 Typical compression ratios of 0.5 to 1.2 are achieved with complex 8-bit are achieved with complex 8-bit monochrome images monochrome images

• Thus without further processing, this is not Thus without further processing, this is not a good compression technique for a good compression technique for complex imagescomplex images

• Bitplane-RLC is most useful for simple Bitplane-RLC is most useful for simple images, such as graphics files, where images, such as graphics files, where much higher compression ratios are much higher compression ratios are achieved achieved

Page 82: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 8282

• The compression results using this The compression results using this method can be improved by preprocessing method can be improved by preprocessing to reduce the number of gray levels, but to reduce the number of gray levels, but then the compression isthen the compression is not lossless not lossless

• With lossless bitplane RLC we can With lossless bitplane RLC we can improve the compression results by taking improve the compression results by taking our original pixel data (in our original pixel data (in natural codenatural code) and ) and mapping it to a mapping it to a Gray codeGray code (named after (named after Frank Gray), where adjacent numbers Frank Gray), where adjacent numbers differ in only one bit differ in only one bit

Page 83: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 8383

• As the adjacent pixel values are highly As the adjacent pixel values are highly correlated, adjacent pixel values tend to correlated, adjacent pixel values tend to be relatively close in gray level value, and be relatively close in gray level value, and this can be problematic for RLC this can be problematic for RLC

Page 84: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 8484

Page 85: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 8585

Page 86: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 8686

• When a situation such as the above When a situation such as the above example occurs, each bitplane example occurs, each bitplane experiences a transition, which adds a experiences a transition, which adds a code for the run in each bitplanecode for the run in each bitplane

• However, with the Gray code, only one However, with the Gray code, only one bitplane experiences the transition, so it bitplane experiences the transition, so it only adds one extra code word only adds one extra code word

• By preprocessing with a Gray code we can By preprocessing with a Gray code we can achieve about a 10% to 15% increase in achieve about a 10% to 15% increase in compression with bitplane-RLC for typical compression with bitplane-RLC for typical images images

Page 87: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 8787

• Another way to extend basic RLC to gray Another way to extend basic RLC to gray level images is to include the gray level of level images is to include the gray level of a particular run as part of the code a particular run as part of the code

• Here, instead of a single value for a run, Here, instead of a single value for a run, two parameters are used to characterize two parameters are used to characterize the runthe run

• The pair (G,L) correspond to the gray level The pair (G,L) correspond to the gray level value, G, and the run length, L value, G, and the run length, L

• This technique is only effective with This technique is only effective with images containing a small number of gray images containing a small number of gray levelslevels

Page 88: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 8888

Page 89: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 8989

Page 90: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 9090

• The decompression process requires the The decompression process requires the number of pixels in a row, and the type of number of pixels in a row, and the type of encoding used encoding used

• Standards for RLC have been defined by Standards for RLC have been defined by the International Telecommunications the International Telecommunications Union-Radio (ITU-R, previously CCIR)Union-Radio (ITU-R, previously CCIR)

• These standards use horizontal RLC, but These standards use horizontal RLC, but

postprocess the resulting RLC with a postprocess the resulting RLC with a Huffman encoding scheme Huffman encoding scheme

Page 91: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 9191

• Newer versions of this standard also utilize Newer versions of this standard also utilize a two-dimensional technique where the a two-dimensional technique where the current line is encoded based on a current line is encoded based on a previous line, which helps to reduce the previous line, which helps to reduce the file size file size

• These encoding methods provide These encoding methods provide compression ratios of about 15 to 20 for compression ratios of about 15 to 20 for typical documents typical documents

Page 92: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 9292

Lempel-Ziv-Welch CodingLempel-Ziv-Welch Coding

• The Lempel-Ziv-Welch (LZW) coding The Lempel-Ziv-Welch (LZW) coding algorithm works by encoding strings of algorithm works by encoding strings of data, which correspond to sequences of data, which correspond to sequences of pixel values in images pixel values in images

• It works by creating a string table that It works by creating a string table that contains the strings and their contains the strings and their corresponding codes corresponding codes

Page 93: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 9393

• The string table is updated as the file is The string table is updated as the file is read, with new codes being inserted read, with new codes being inserted whenever a new string is encountered whenever a new string is encountered

• If a string is encountered that is already in If a string is encountered that is already in the table, the corresponding code for that the table, the corresponding code for that string is put into the compressed filestring is put into the compressed file

• LZW coding uses code words with more LZW coding uses code words with more

bits than the original data bits than the original data

Page 94: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 9494

For Example:For Example:

• With 8-bit image data, an LZW coding With 8-bit image data, an LZW coding method could employ 10-bit wordsmethod could employ 10-bit words

• The corresponding string table would then The corresponding string table would then have 2have 210 10 = 1024 entries= 1024 entries

• This table consists of the original 256 This table consists of the original 256 entries, corresponding to the original 8-bit entries, corresponding to the original 8-bit data, and allows 768 other entries for data, and allows 768 other entries for string codes string codes

Page 95: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 9595

• The string codes are assigned during the The string codes are assigned during the compression process, but the actual string compression process, but the actual string table is not stored with the compressed table is not stored with the compressed datadata

• During decompression the information in During decompression the information in the string table is extracted from the the string table is extracted from the compressed data itself compressed data itself

Page 96: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 9696

• For the GIF (and TIFF) image file format For the GIF (and TIFF) image file format the LZW algorithm is specified, but there the LZW algorithm is specified, but there has been some controversy over this, has been some controversy over this, since the algorithm is patented by Unisys since the algorithm is patented by Unisys CorporationCorporation

• Since these image formats are widely Since these image formats are widely used, other methods similar in nature to used, other methods similar in nature to the LZW algorithm have been developed the LZW algorithm have been developed to be used with these, or similar, image file to be used with these, or similar, image file formats formats

Page 97: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 9797

• Similar versions of this algorithm include Similar versions of this algorithm include the the adaptive Lempel-Zivadaptive Lempel-Ziv, used in the UNIX , used in the UNIX compress function, and the compress function, and the Lempel-Ziv 77Lempel-Ziv 77 algorithm used in the UNIX gzip function algorithm used in the UNIX gzip function

Page 98: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 9898

Arithmetic Coding Arithmetic Coding

• Arithmetic codingArithmetic coding transforms input data transforms input data into a single floating point number into a single floating point number between 0 and 1between 0 and 1

• There is not a direct correspondence There is not a direct correspondence

between the code and the individual pixel between the code and the individual pixel values values

Page 99: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 9999

• As each input symbol (pixel value) is read As each input symbol (pixel value) is read the precision required for the number the precision required for the number becomes greater becomes greater

• As the images are very large and the As the images are very large and the precision of digital computers is finite, the precision of digital computers is finite, the entire image must be divided into small entire image must be divided into small subimages to be encoded subimages to be encoded

Page 100: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 100100

• Arithmetic coding uses the probability Arithmetic coding uses the probability distribution of the data (histogram), so it distribution of the data (histogram), so it can theoretically achieve the maximum can theoretically achieve the maximum compression specified by the entropy compression specified by the entropy

• It works by successively subdividing the It works by successively subdividing the interval between 0 and 1, based on the interval between 0 and 1, based on the placement of the current pixel value in the placement of the current pixel value in the probability distribution probability distribution

Page 101: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 101101

Page 102: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 102102

Page 103: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 103103

Page 104: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 104104

• In practice, this technique may be used as In practice, this technique may be used as part of an image compression scheme, but part of an image compression scheme, but is impractical to use aloneis impractical to use alone

• It is one of the options available in the It is one of the options available in the JPEG standard JPEG standard

Page 105: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 105105

Lossy Compression MethodsLossy Compression Methods

Lossy compression methods are required Lossy compression methods are required to achieve high compression ratios with to achieve high compression ratios with complex imagescomplex images

They provides tradeoffs between image They provides tradeoffs between image quality and degree of compression, which quality and degree of compression, which allows the compression algorithm to be allows the compression algorithm to be customized to the applicationcustomized to the application

Page 106: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 106106

Page 107: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 107107

With more advanced methods, images can With more advanced methods, images can be compressed 10 to 20 times with be compressed 10 to 20 times with virtually no visible information loss, and 30 virtually no visible information loss, and 30 to 50 times with minimal degradation to 50 times with minimal degradation

Newer techniques, such as Newer techniques, such as JPEG2000JPEG2000, , can achieve reasonably good image can achieve reasonably good image quality with compression ratios as high as quality with compression ratios as high as 100 to 200 100 to 200

Image enhancementImage enhancement and and restoration restoration techniquestechniques can be combined with lossy can be combined with lossy compression schemes to improve the compression schemes to improve the appearance of the decompressed imageappearance of the decompressed image

Page 108: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 108108

In general, a higher compression ratio In general, a higher compression ratio results in a poorer image, but the results results in a poorer image, but the results are highly image dependent – application are highly image dependent – application specificspecific

Lossy compression can be performed in Lossy compression can be performed in both the both the spatialspatial and and transformtransform domains domains. . Hybrid methodsHybrid methods use both domains. use both domains.

Page 109: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 109109

Gray-Level Run Length CodingGray-Level Run Length Coding

• The RLC technique can also be used for The RLC technique can also be used for lossy image compression, by reducing the lossy image compression, by reducing the number of gray levels, and then applying number of gray levels, and then applying standard RLC techniques standard RLC techniques

• As with the lossless techniques, As with the lossless techniques, preprocessing by Gray code mapping will preprocessing by Gray code mapping will improve the compression ratio improve the compression ratio

Page 110: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 110110

Figure 10.3-2 Lossy Bitplane Run Length Coding

Note: No compression occurs until reduction to 5 bits/pixel

b) Image after reduction to 7 bits/pixel, 128 gray levels, compression ratio 0.55, with Gray code preprocessing 0.66

a) Original image, 8 bits/pixel, 256 gray levels

Page 111: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 111111

Figure 10.3-2 Lossy Bitplane Run Length Coding (contd)

d) Image after reduction to 5 bits/pixel, 32 gray levels, compression ratio 1.20, with Gray code preprocessing 1.60

c) Image after reduction to 6 bits/pixel, 64 gray levels, compression ratio 0.77, with Gray code preprocessing 0.97

Page 112: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 112112

Figure 10.3-2 Lossy Bitplane Run Length Coding (contd)

f) Image after reduction to 3 bits/pixel, 8 gray levels, compression ratio 4.86, with Gray code preprocessing 5.82

e) Image after reduction to 4 bits/pixel, 16 gray levels, compression ratio 2.17, with Gray code preprocessing 2.79

Page 113: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 113113

Figure 10.3-2 Lossy Bitplane Run Length Coding (contd)

h) Image after reduction to 1 bit/pixel, 2 gray levels, compression ratio 44.46, with Gray code preprocessing 44.46

g) Image after reduction to 2 bits/pixel, 4 gray levels, compression ratio 13.18, with Gray code preprocessing 15.44

Page 114: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 114114

• A more sophisticated method is A more sophisticated method is dynamic dynamic window-based RLCwindow-based RLC

• This algorithm relaxes the criterion of the This algorithm relaxes the criterion of the runs being the same value and allows for runs being the same value and allows for the runs to fall within a gray level range, the runs to fall within a gray level range, called the called the dynamic window rangedynamic window range

• This range is dynamic because it starts out This range is dynamic because it starts out larger than the actual gray level window larger than the actual gray level window range, and maximum and minimum values range, and maximum and minimum values are narrowed down to the actual range as are narrowed down to the actual range as each pixel value is encounteredeach pixel value is encountered

Page 115: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 115115

• This process continues until a pixel is This process continues until a pixel is found out of the actual range found out of the actual range

• The image is encoded with two values, The image is encoded with two values, one for the run length and one to one for the run length and one to approximate the gray level value of the runapproximate the gray level value of the run

• This approximation can simply be the This approximation can simply be the average of all the gray level values in the average of all the gray level values in the run run

Page 116: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 116116

Page 117: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 117117

Page 118: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 118118

Page 119: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 119119

• This particular algorithm also uses some This particular algorithm also uses some preprocessing to allow for the run-length preprocessing to allow for the run-length mapping to be coded so that a run can be mapping to be coded so that a run can be any length and is not constrained by the any length and is not constrained by the length of a row length of a row

Page 120: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 120120

Block Truncation CodingBlock Truncation Coding

• Block truncation codingBlock truncation coding (BTC) works by (BTC) works by dividing the image into small subimages dividing the image into small subimages and then reducing the number of gray and then reducing the number of gray levels within each blocklevels within each block

• The gray levels are reduced by a The gray levels are reduced by a quantizerquantizer

that adapts to local statisticsthat adapts to local statistics

Page 121: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 121121

• The levels for the quantizer are chosen to The levels for the quantizer are chosen to minimize a specified error criteria, and minimize a specified error criteria, and then all the pixel values within each block then all the pixel values within each block are mapped to the quantized levelsare mapped to the quantized levels

• The necessary information to decompress The necessary information to decompress the image is then encoded and storedthe image is then encoded and stored

• The basic form of BTC divides the image The basic form of BTC divides the image into N * Ninto N * N blocks and codes each block blocks and codes each block using a two-level quantizer using a two-level quantizer

Page 122: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 122122

• The two levels are selected so that the The two levels are selected so that the mean and variance of the gray levels mean and variance of the gray levels within the block are preserved within the block are preserved

• Each pixel value within the block is then Each pixel value within the block is then compared with a threshold, typically the compared with a threshold, typically the block mean, and then is assigned to one block mean, and then is assigned to one of the two levels of the two levels

• If it is above the mean it is assigned the If it is above the mean it is assigned the high level code, if it is below the mean, it is high level code, if it is below the mean, it is assigned the low level code assigned the low level code

Page 123: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 123123

• If we call the high value If we call the high value H H and the low and the low value value LL, we can find these values via the , we can find these values via the following equations:following equations:

Page 124: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 124124

• If If n = 4n = 4, then after the , then after the HH and and LL values are values are found, the 4x4 block is encoded with four found, the 4x4 block is encoded with four bytes bytes

• Two bytes to store the two levels, Two bytes to store the two levels, HH and and LL, , and two bytes to store a bit string of 1's and two bytes to store a bit string of 1's and 0's corresponding to the high and low and 0's corresponding to the high and low codes for that particular block codes for that particular block

Page 125: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 125125

Page 126: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 126126

Page 127: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 127127

Page 128: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 128128

• This algorithm tends to produce images This algorithm tends to produce images with blocky effectswith blocky effects

• These artifacts can be smoothed by These artifacts can be smoothed by applying enhancement techniques such as applying enhancement techniques such as median and average (lowpass) filters median and average (lowpass) filters

Page 129: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 129129

Page 130: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 130130

Page 131: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 131131

• The The multilevel BTC algorithm,multilevel BTC algorithm, which uses which uses a 4-level quantizer, allows for varying the a 4-level quantizer, allows for varying the block size, and a larger block size should block size, and a larger block size should provide higher compression, but with a provide higher compression, but with a corresponding decrease in image qualitycorresponding decrease in image quality

• With this particular implementation, we get With this particular implementation, we get decreasing image quality, but the decreasing image quality, but the compression ratio is fixed compression ratio is fixed

Page 132: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 132132

Page 133: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 133133

Page 134: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 134134

Vector QuantizationVector Quantization

• Vector quantization (VQ)Vector quantization (VQ) is the process of is the process of mapping a vector that can have many mapping a vector that can have many values to a vector that has a smaller values to a vector that has a smaller (quantized) number of values(quantized) number of values

• For image compression, the vector For image compression, the vector corresponds to a small subimage, or blockcorresponds to a small subimage, or block

Page 135: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 135135

Page 136: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 136136

• VQ can be applied in both the spectral or VQ can be applied in both the spectral or spatial domainsspatial domains

• Information theory tells us that better Information theory tells us that better compression can be achieved with vector compression can be achieved with vector quantization than with scalar quantization quantization than with scalar quantization (rounding or truncating individual values)(rounding or truncating individual values)

Page 137: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 137137

• Vector quantization treats the entire Vector quantization treats the entire subimage (vector) as a single entity and subimage (vector) as a single entity and quantizes it by reducing the total number quantizes it by reducing the total number of bits required to represent the subimage of bits required to represent the subimage

• This is done by utilizing a This is done by utilizing a codebookcodebook, which , which stores a fixed set of vectors, and then stores a fixed set of vectors, and then coding the subimage by using the index coding the subimage by using the index (address) into the codebook(address) into the codebook

Page 138: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 138138

• In the example we achieved a 16:1 In the example we achieved a 16:1 compression, but note that this assumes compression, but note that this assumes that the codebook is not stored with the that the codebook is not stored with the compressed filecompressed file

Page 139: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 139139

Page 140: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 140140

• However, the codebook will need to be However, the codebook will need to be stored unless a generic codebook is stored unless a generic codebook is devised which could be used for a devised which could be used for a particular type of image, in that case we particular type of image, in that case we need only store the name of that particular need only store the name of that particular codebook file codebook file

• In the general case, better results will be In the general case, better results will be obtained with a codebook that is designed obtained with a codebook that is designed for a particular image for a particular image

Page 141: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 141141

Page 142: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 142142

• A training algorithm determines which A training algorithm determines which vectors will be stored in the codebook by vectors will be stored in the codebook by finding a set of vectors that best represent finding a set of vectors that best represent the blocks in the imagethe blocks in the image

• This set of vectors is determined by This set of vectors is determined by optimizing some error criterion, where the optimizing some error criterion, where the errorerror is defined as the sum of the vector is defined as the sum of the vector distances between the original subimages distances between the original subimages and the resulting decompressed and the resulting decompressed subimages subimages

Page 143: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 143143

• The standard algorithm to generate the The standard algorithm to generate the codebook is the Linde-Buzo-Gray (codebook is the Linde-Buzo-Gray (LBGLBG) ) algorithm, also called the algorithm, also called the K-meansK-means or the or the clusteringclustering algorithm: algorithm:

Page 144: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 144144

• The LBG algorithm, along with other The LBG algorithm, along with other iterative codebook design algorithms do iterative codebook design algorithms do not, in general, yield globally optimum not, in general, yield globally optimum codes codes

• These algorithms will converge to a local These algorithms will converge to a local minimum in the error (distortion) space minimum in the error (distortion) space

• Theoretically, to improve the codebook, Theoretically, to improve the codebook, the algorithm is repeated with different the algorithm is repeated with different initial random codebooks and the one initial random codebooks and the one codebook that minimizes distortion is codebook that minimizes distortion is chosen chosen

Page 145: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 145145

• However, the LBG algorithm will typically However, the LBG algorithm will typically yield "good" codes if the initial codebook is yield "good" codes if the initial codebook is carefully chosen by subdividing the vector carefully chosen by subdividing the vector space and finding the centroid for the space and finding the centroid for the sample vectors within each divisionsample vectors within each division

• These centroids are then used as the These centroids are then used as the initial codebookinitial codebook

• Alternately, a subset of the training Alternately, a subset of the training vectors, preferably spread across the vectors, preferably spread across the vector space, can be randomly selected vector space, can be randomly selected and used to initialize the codebookand used to initialize the codebook

Page 146: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 146146

• The primary advantage of vector The primary advantage of vector quantization is simple and fast quantization is simple and fast decompression, but with the high cost of decompression, but with the high cost of complex compressioncomplex compression

• The decompression process requires the The decompression process requires the use of the codebook to recreate the use of the codebook to recreate the image, which can be easily implemented image, which can be easily implemented with a look-up table (LUT)with a look-up table (LUT)

Page 147: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 147147

• This type of compression is useful for This type of compression is useful for applications where the images are applications where the images are compressed once and decompressed compressed once and decompressed many times, such as images on an many times, such as images on an Internet siteInternet site

• However, it cannot be used for real-time However, it cannot be used for real-time applicationsapplications

Page 148: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 148148

Figure 10.3-8 Vector Quantization in the Spatial Domain

b) VQ with 4x4 vectors, and a codebook of 128 entries, compression ratio = 11.49

a) Original image

Page 149: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 149149

d) VQ with 4x4 vectors, and a codebook of 512 entries, compression ratio = 5.09

c) VQ with 4x4 vectors, and a codebook of 256 entries, compression ratio = 7.93

Figure 10.3-8 Vector Quantization in the Spatial Domain (contd)

Note: As the codebook size is increased the image quality improves and the compression ratio decreases

Page 150: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 150150

Figure 10.3-9 Vector Quantization in the Transform Domain

Note: The original image is the image in Figure 10.3-8a

b) VQ with the wavelet transform, compression ratio = 9.21

a) VQ with the discrete cosine transform, compression ratio = 9.21

Page 151: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 151151

Figure 10.3-9 Vector Quantization in the Transform Domain (contd)

d) VQ with the wavelet transform, compression ratio = 3.44

c) VQ with the discrete cosine transform, compression ratio = 3.44

Page 152: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 152152

Differential Predictive CodingDifferential Predictive Coding

• Differential predictive coding (DPC) Differential predictive coding (DPC) predicts the next pixel value based on predicts the next pixel value based on previous values, and encodes the previous values, and encodes the difference between predicted and actual difference between predicted and actual value – the error signalvalue – the error signal

• This technique takes advantage of the fact This technique takes advantage of the fact that adjacent pixels are highly correlated, that adjacent pixels are highly correlated, except at object boundaries except at object boundaries

Page 153: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 153153

• Typically the difference, or error, will be Typically the difference, or error, will be small which minimizes the number of bits small which minimizes the number of bits required for compressed file required for compressed file

• This error is then quantized, to further This error is then quantized, to further reduce the data and to optimize visual reduce the data and to optimize visual results, and can then be coded results, and can then be coded

Page 154: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 154154

Page 155: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 155155

• From the block diagram, we have the From the block diagram, we have the following:following:

• The prediction equation is typically a The prediction equation is typically a function of the previous pixel(s), and can function of the previous pixel(s), and can also include global or application-specific also include global or application-specific information information

Page 156: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 156156

Page 157: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 157157

• This quantized error can be encoded using This quantized error can be encoded using a lossless encoder, such as a Huffman a lossless encoder, such as a Huffman codercoder

• It should be noted that it is important that It should be noted that it is important that the predictor uses the same values during the predictor uses the same values during both compression and decompression; both compression and decompression; specifically the reconstructed values and specifically the reconstructed values and not the original values not the original values

Page 158: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 158158

Page 159: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 159159

Page 160: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 160160

• The prediction equation can be one-The prediction equation can be one-dimensional or two-dimensional, that is, it dimensional or two-dimensional, that is, it can be based on previous values in the can be based on previous values in the current row only, or on previous rows also current row only, or on previous rows also

• The following prediction equations are The following prediction equations are typical examples of those used in practice, typical examples of those used in practice, with the first being one-dimensional and with the first being one-dimensional and the next two being two-dimensionalthe next two being two-dimensional::

Page 161: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 161161

Page 162: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 162162

• Using more of the previous values in the Using more of the previous values in the predictor increases the complexity of the predictor increases the complexity of the computations for both compression and computations for both compression and decompressiondecompression

• It has been determined that using more It has been determined that using more than three of the previous values provides than three of the previous values provides no significant improvement in the resulting no significant improvement in the resulting image image

Page 163: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 163163

• The results of DPC can be improved by The results of DPC can be improved by using an optimal quantizer, such as the using an optimal quantizer, such as the Lloyd-Max quantizerLloyd-Max quantizer, instead of simply , instead of simply truncating the resulting errortruncating the resulting error

• The Lloyd-Max quantizer assumes a The Lloyd-Max quantizer assumes a

specific distribution for the prediction errorspecific distribution for the prediction error

Page 164: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 164164

• Assuming a 2-bit code for the error, and a Assuming a 2-bit code for the error, and a Laplacian distribution for the error, the Laplacian distribution for the error, the Lloyd-Max quantizer is defined as follows:Lloyd-Max quantizer is defined as follows:

Page 165: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 165165

Page 166: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 166166

• For most images, the standard deviation For most images, the standard deviation for the error signal is between 3 and 15 for the error signal is between 3 and 15

• After the data is quantized it can be further After the data is quantized it can be further compressed with a lossless coder such as compressed with a lossless coder such as Huffman or arithmetic coding Huffman or arithmetic coding

Page 167: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 167167

Page 168: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 168168

Page 169: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 169169

Page 170: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 170170

Page 171: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 171171

Figure 10.3.15 DPC Quantization (contd)

h) Lloyd-Max quantizer, using 4 bits/pixel, normalized correlation = 0.90, with standard deviation = 10

i) Error image for (h)

j) Lloyd-Max quantizer, using 5 bits/pixel, normalized correlation = 0.90, with standard deviation = 10

k) Error image for (j)

Page 172: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 172172

Model-based and Fractal CompressionModel-based and Fractal Compression

• Model-based Model-based oror intelligent intelligent compression compression works by finding models for objects within works by finding models for objects within the image and using model parameters for the image and using model parameters for the compressed file the compressed file

• The techniques used are similar to The techniques used are similar to computer vision methods where the goal is computer vision methods where the goal is to find descriptions of the objects in the to find descriptions of the objects in the image image

Page 173: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 173173

• The objects are often defined by lines or The objects are often defined by lines or shapes (boundaries), so a Hough shapes (boundaries), so a Hough transform (Chap 4) may be used, while the transform (Chap 4) may be used, while the object interiors can be defined by object interiors can be defined by statistical texture modeling statistical texture modeling

• The model-based methods can achieve The model-based methods can achieve very high compression ratios, but the very high compression ratios, but the decompressed images often have an decompressed images often have an artificial look to themartificial look to them

• Fractal methodsFractal methods are an example of model- are an example of model-based compression techniques based compression techniques

Page 174: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 174174

• Fractal image compression is based on Fractal image compression is based on the idea that if an image is divided into the idea that if an image is divided into subimages, many of the subimages will be subimages, many of the subimages will be self-similar self-similar

• Self-similarSelf-similar means that one subimage can means that one subimage can be represented as a skewed, stretched, be represented as a skewed, stretched, rotated, scaled and/or translated version of rotated, scaled and/or translated version of another subimage another subimage

Page 175: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 175175

• Treating the image as a geometric plane, Treating the image as a geometric plane, the mathematical operations (skew, the mathematical operations (skew, stretch, scale, rotate, translate) are called stretch, scale, rotate, translate) are called affine transformationsaffine transformations and can be and can be represented by the following general represented by the following general equations:equations:

Page 176: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 176176

• Fractal compression is somewhat like Fractal compression is somewhat like vector quantization, except that the vector quantization, except that the subimages, or blocks, can vary in size and subimages, or blocks, can vary in size and shape shape

• The idea is to find a good set of basis The idea is to find a good set of basis images, or fractals, that can undergo affine images, or fractals, that can undergo affine transformations, and then be assembled transformations, and then be assembled into a good representation of the image into a good representation of the image

• The fractals (basis images), and the The fractals (basis images), and the necessary affine transformation necessary affine transformation coefficients are then stored in the coefficients are then stored in the compressed file compressed file

Page 177: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 177177

• Fractal compression can provide high Fractal compression can provide high quality images and very high compression quality images and very high compression rates, but often at a very high cost rates, but often at a very high cost

• The quality of the resulting decompressed The quality of the resulting decompressed image is directly related to the amount of image is directly related to the amount of time taken in generating the fractal time taken in generating the fractal compressed imagecompressed image

• If the compression is done offline, one If the compression is done offline, one time, and the images are to be used many time, and the images are to be used many times, it may be worth the cost times, it may be worth the cost

Page 178: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 178178

• An advantage of fractals is that they can An advantage of fractals is that they can be magnified as much as is desired, so be magnified as much as is desired, so one fractal compressed image file can be one fractal compressed image file can be used for any resolution or size of imageused for any resolution or size of image

• To apply fractal compression, the image is To apply fractal compression, the image is first divided into non-overlapping regions first divided into non-overlapping regions that completely cover the image, called that completely cover the image, called domainsdomains

• Then, regions of various size and shape Then, regions of various size and shape are chosen for the basis images, called are chosen for the basis images, called the the rangerange regions regions

Page 179: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 179179

• The range regions are typically larger than The range regions are typically larger than the domain regions, can be overlapping the domain regions, can be overlapping and do not cover the entire image and do not cover the entire image

• The goal is to find the set affine The goal is to find the set affine transformations to best match the range transformations to best match the range regions to the domain regionsregions to the domain regions

• The methods used to find the best range The methods used to find the best range regions for the image, as well as the best regions for the image, as well as the best transformations, are many and varied transformations, are many and varied

Page 180: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 180180

Figure 10.3-16 Fractal Compression

a) Cameraman image compressed with fractal encoding, compression ratio = 9.19

b) Error image for (a)

Page 181: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 181181

Figure 10.3-16 Fractal Compression (contd)

c) Compression ratio = 15.65 d) Error image for (c)

Page 182: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 182182

Figure 10.3-16 Fractal Compression (contd)

f) Error image for (e) e) Compression ratio = 34.06

Page 183: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 183183

Figure 10.3-16 Fractal Compression (contd)

g) A checkerboard, compression ratio = 564.97

h) Error image for (g)

Note: Error images have been remapped for display so the background gray corresponds to zero, then they were enhanced by a histogram stretch to show detail

Page 184: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 184184

Transform CodingTransform Coding

• Transform coding,Transform coding, is a form of block is a form of block coding done in the transform domain coding done in the transform domain

• The image is divided into blocks, or The image is divided into blocks, or subimages, and the transform is subimages, and the transform is calculated for each blockcalculated for each block

Page 185: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 185185

• Any of the previously defined transforms Any of the previously defined transforms can be used, frequency (e.g. Fourier) or can be used, frequency (e.g. Fourier) or sequency (e.g. Walsh/Hadamard), but it sequency (e.g. Walsh/Hadamard), but it has been determined that the discrete has been determined that the discrete cosine transform (DCT) is optimal for most cosine transform (DCT) is optimal for most images images

• The newer JPEG2000 algorithms uses the The newer JPEG2000 algorithms uses the wavelet transform, which has been found wavelet transform, which has been found to provide even better compression to provide even better compression

Page 186: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 186186

• After the transform has been calculated, After the transform has been calculated, the transform coefficients are quantized the transform coefficients are quantized and codedand coded

• This method is effective because the This method is effective because the frequency/sequency transform of images frequency/sequency transform of images is very efficient at putting most of the is very efficient at putting most of the information into relatively few coefficients, information into relatively few coefficients, so many of the high frequency coefficients so many of the high frequency coefficients can be quantized to 0 (eliminated can be quantized to 0 (eliminated completely) completely)

Page 187: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 187187

• This type of transform is a special type of This type of transform is a special type of mapping that uses spatial frequency mapping that uses spatial frequency concepts as a basis for the mappingconcepts as a basis for the mapping

• The main reason for mapping the original The main reason for mapping the original data into another mathematical space is to data into another mathematical space is to pack the information (or energy) into as pack the information (or energy) into as few coefficients as possible few coefficients as possible

Page 188: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 188188

• The simplest form of transform coding is The simplest form of transform coding is achieved by achieved by filteringfiltering by eliminating some by eliminating some of the high frequency coefficientsof the high frequency coefficients

• However, this will not provide much However, this will not provide much

compression, since the transform data is compression, since the transform data is typically typically floating pointfloating point and thus 4 or 8 and thus 4 or 8 bytes per pixel (compared to the original bytes per pixel (compared to the original pixel data at 1 byte per pixel), so pixel data at 1 byte per pixel), so quantization and coding is applied to the quantization and coding is applied to the reduced data reduced data

Page 189: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 189189

• Quantization includes a process called Quantization includes a process called bit bit allocationallocation, which determines the number , which determines the number of bits to be used to code each coefficient of bits to be used to code each coefficient based on its importancebased on its importance

• Typically, more bits are used for lower Typically, more bits are used for lower

frequency components where the energy frequency components where the energy is concentrated for most images, resulting is concentrated for most images, resulting in a in a variable bit ratevariable bit rate or or nonuniform nonuniform quantization quantization and better resolutionand better resolution

Page 190: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 190190

Page 191: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 191191

• Then a quantization scheme, such as Then a quantization scheme, such as Lloyd-Max quantization is applied Lloyd-Max quantization is applied

• As the zero-frequency coefficient for real As the zero-frequency coefficient for real images contains a large portion of the images contains a large portion of the energy in the image and is always energy in the image and is always positive, it is typically treated differently positive, it is typically treated differently than the higher frequency coefficients than the higher frequency coefficients

• Often this term is not quantized at all, or Often this term is not quantized at all, or the differential between blocks is encoded the differential between blocks is encoded

• After they have been quantized, the After they have been quantized, the coefficients can be coded using, for coefficients can be coded using, for example, a Huffman or arithmetic coding example, a Huffman or arithmetic coding methodmethod

Page 192: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 192192

• Two particular types of transform coding Two particular types of transform coding have been widely explored: have been widely explored:

1.1. Zonal codingZonal coding2.2. Threshold codingThreshold coding

• These two vary in the method they use These two vary in the method they use for selecting the transform coefficients to for selecting the transform coefficients to retain (using ideal filters for transform retain (using ideal filters for transform coding selects the coefficients based on coding selects the coefficients based on their location in the transform domain) their location in the transform domain)

Page 193: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 193193

1.1. Zonal codingZonal coding

• It involves selecting specific coefficients It involves selecting specific coefficients based on maximal variance based on maximal variance

• A zonal mask is determined for the entire A zonal mask is determined for the entire image by finding the variance for each image by finding the variance for each frequency componentfrequency component

• This variance is calculated by using each This variance is calculated by using each subimage within the image as a separate subimage within the image as a separate sample and then finding the variance sample and then finding the variance within this group of subimages within this group of subimages

Page 194: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 194194

Page 195: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 195195

• The The zonal mask zonal mask is a bitmap of 1's and 0', is a bitmap of 1's and 0', where the 1's correspond to the where the 1's correspond to the coefficients to retain, and the 0's to the coefficients to retain, and the 0's to the ones to eliminate ones to eliminate

• As the zonal mask applies to the As the zonal mask applies to the entire entire image, image, only one mask is required only one mask is required

Page 196: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 196196

2.2. Threshold codingThreshold coding

• It selects the transform coefficients It selects the transform coefficients based on specific valuebased on specific value

• A different threshold mask is required for A different threshold mask is required for each block, which increases file size as each block, which increases file size as well as algorithmic complexitywell as algorithmic complexity

Page 197: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 197197

• In practice, the zonal mask is often In practice, the zonal mask is often predetermined because the low frequency predetermined because the low frequency terms tend to contain the most information, terms tend to contain the most information, and hence exhibit the most variance and hence exhibit the most variance

• In this case we select a fixed mask of a In this case we select a fixed mask of a given shape and desired compression given shape and desired compression ratio, which streamlines the compression ratio, which streamlines the compression processprocess

Page 198: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 198198

• It also saves the overhead involved in It also saves the overhead involved in calculating the variance of each group of calculating the variance of each group of subimages for compression and also subimages for compression and also eases the decompression process eases the decompression process

• Typical masks may be square, triangular Typical masks may be square, triangular or circular and the cutoff frequency is or circular and the cutoff frequency is determined by the compression ratio determined by the compression ratio

Page 199: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 199199

Figure 10.3-18 Zonal Compression with DCT and Walsh Transforms

A block size of 64x64 was used, a circular zonal mask, and DC coefficients were not quantized

c) Error image comparing the original and (b), histogram stretched to show detail

a) Original image, a view of St. Louis, Missouri, from the Gateway Arch

b) Results from using the DCT with a compression ratio = 4.27

Page 200: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 200200

Figure 10.3-18 Zonal Compression with DCT and Walsh Transforms

(contd)

e) Error image comparing the original and (d), histogram stretched to show detail,

d) Results from using the DCT with a compression ratio = 14.94

Page 201: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 201201

Figure 10.3-18 Zonal Compression with DCT and Walsh Transforms

(contd)

g) Error image comparing the original and (f), histogram stretched to show detail

f) Results from using the Walsh Transform (WHT) with a compression ratio = 4.27

Page 202: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 202202

Figure 10.3-18 Zonal Compression with DCT and Walsh Transforms

(contd)

i) Error image comparing the original and (h), histogram stretched to show detail

h) Results from using the WHT with a compression ratio = 14.94

Page 203: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 203203

• One of the most commonly used image One of the most commonly used image compression standards is primarily a form compression standards is primarily a form of transform coding of transform coding

• The Joint Photographic Expert Group The Joint Photographic Expert Group (JPEG) under the auspices of the (JPEG) under the auspices of the International Standards Organization (ISO) International Standards Organization (ISO) devised a family of image compression devised a family of image compression methods for still images methods for still images

• The original JPEG standard uses the DCT The original JPEG standard uses the DCT and 8x8 pixel blocks as the basis for and 8x8 pixel blocks as the basis for compressioncompression

Page 204: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 204204

• Before computing the DCT, the pixel Before computing the DCT, the pixel values are level shifted so that they are values are level shifted so that they are centered at zerocentered at zero

• EXAMPLE 10.3.7: EXAMPLE 10.3.7: A typical 8-bit image has a range of gray A typical 8-bit image has a range of gray levels of 0 to 255. Level shifting this range levels of 0 to 255. Level shifting this range to be centered at zero involves subtracting to be centered at zero involves subtracting 128 from each pixel value, so the resulting 128 from each pixel value, so the resulting range is from -128 to 127 range is from -128 to 127

Page 205: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 205205

• After level shifting, the DCT is computedAfter level shifting, the DCT is computed

• Next, the DCT coefficients are quantized Next, the DCT coefficients are quantized by dividing by the values in a quantization by dividing by the values in a quantization table and then truncated table and then truncated

• For color signals JPEG transforms the For color signals JPEG transforms the RGB components into the RGB components into the YCrCbYCrCb color color space, and subsamples the two color space, and subsamples the two color difference signals (difference signals (CrCr and and CbCb), since we ), since we perceive more detail in the luminance perceive more detail in the luminance (brightness) than in the color information(brightness) than in the color information

Page 206: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 206206

• Once the coefficients are quantized, they Once the coefficients are quantized, they are coded using a Huffman codeare coded using a Huffman code

• The zero-frequency coefficient (DC term) The zero-frequency coefficient (DC term) is differentially encoded relative to the is differentially encoded relative to the previous block previous block

Page 207: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 207207

These quantization tables were experimentally determined by JPEG to take advantage of the human visual system’s response to spatial frequency which peaks around 4 or 5 cycles per degree

Page 208: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 208208

Page 209: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 209209

Page 210: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 210210

Figure 10.3-21:The Original DCT-based JPEG Algorithm Applied to a Color Image

b) Compression ratio = 34.34 a) The original image

Page 211: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 211211

Figure 10.3-21:The Original DCT-based JPEG Algorithm Applied to a Color Image (contd)

d) Compression ratio = 79.95 c) Compression ratio = 57.62

Page 212: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 212212

Figure 10.3-21:The Original DCT-based JPEG Algorithm Applied to a Color Image (contd)

f) Compression ratio = 201.39e) Compression ratio = 131.03

Page 213: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 213213

Hybrid and Wavelet MethodsHybrid and Wavelet Methods

• Hybrid methods use both the spatial and Hybrid methods use both the spatial and spectral domainsspectral domains

• Algorithms exist that combine differential Algorithms exist that combine differential coding and spectral transforms for analog coding and spectral transforms for analog video compressionvideo compression

Page 214: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 214214

• For digital images these techniques can For digital images these techniques can be applied to blocks (subimages), as well be applied to blocks (subimages), as well as rows or columns as rows or columns

• Vector quantization is often combined with Vector quantization is often combined with these methods to achieve higher these methods to achieve higher compression ratios compression ratios

• The wavelet transform, which localizes The wavelet transform, which localizes information in both the spatial and information in both the spatial and frequency domain, is used in newer hybrid frequency domain, is used in newer hybrid compression methods like the JPEG2000 compression methods like the JPEG2000 standard standard

Page 215: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 215215

• The wavelet transform provides superior The wavelet transform provides superior performance to the DCT-based performance to the DCT-based techniques, and also is useful in techniques, and also is useful in progressive transmission for Internet and progressive transmission for Internet and database use database use

• Progressive transmission allows low Progressive transmission allows low quality images to appear quickly and then quality images to appear quickly and then gradually improve over time as more detail gradually improve over time as more detail information is transmitted or retrieved information is transmitted or retrieved

Page 216: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 216216

• Thus the user need not wait for an entire Thus the user need not wait for an entire high quality image before they decide to high quality image before they decide to view it or move on view it or move on

• The wavelet transform combined with The wavelet transform combined with vector quantization has led to the vector quantization has led to the development of experimental development of experimental compression algorithms compression algorithms

Page 217: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 217217

• The general algorithm is as follows:The general algorithm is as follows:

1.1. Perform the wavelet transform on the Perform the wavelet transform on the image by using convolution masks image by using convolution masks

2.2. Number the different wavelet bands from Number the different wavelet bands from 0 to 0 to N−1N−1, where N is the total number of , where N is the total number of wavelet bands, and 0 is the lowest wavelet bands, and 0 is the lowest frequency (in both horizontal and vertical frequency (in both horizontal and vertical directions) band directions) band

Page 218: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 218218

3.3. Scalar quantize the 0 band linearly to 8 Scalar quantize the 0 band linearly to 8 bitsbits

4.4. Vector quantize the middle bands using Vector quantize the middle bands using a small block size (e.g. 2x2). Decrease a small block size (e.g. 2x2). Decrease the codebook size as the band number the codebook size as the band number increasesincreases

5.5. Eliminate the highest frequency bandsEliminate the highest frequency bands

Page 219: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 219219

Page 220: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 220220

• The example algorithms shown here utilize The example algorithms shown here utilize 10‑band wavelet decomposition 10‑band wavelet decomposition (Figure 10.3-22b), with the Daubecies 4 (Figure 10.3-22b), with the Daubecies 4 element basis vectors, in combination with element basis vectors, in combination with the vector quantization technique the vector quantization technique

• They are called They are called Wavelet/Vector Wavelet/Vector QuantizationQuantization followed by a number followed by a number (WVQ#); specifically WVQ2, WVQ3 and (WVQ#); specifically WVQ2, WVQ3 and WVQ4 WVQ4

Page 221: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 221221

• One algorithm (WVQ4) employs the PCT One algorithm (WVQ4) employs the PCT for preprocessing, before subsampling the for preprocessing, before subsampling the second and third PCT bands by a factor of second and third PCT bands by a factor of 2:1 in the horizontal and vertical direction 2:1 in the horizontal and vertical direction

Page 222: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 222222

Page 223: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 223223

• The table (10.2) lists the wavelet band The table (10.2) lists the wavelet band numbers versus the three WVQ algorithmsnumbers versus the three WVQ algorithms

• For each WVQ algorithm, we have aFor each WVQ algorithm, we have a blocksizeblocksize, , which corresponds to the vector which corresponds to the vector size, and the number of bits, which, for size, and the number of bits, which, for vector quantization, corresponds to the vector quantization, corresponds to the codebook sizecodebook size

• The lowest wavelet band is coded linearly The lowest wavelet band is coded linearly using 8-bit scalar quantization using 8-bit scalar quantization

Page 224: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 224224

• Vector quantization is used for bands 1-8, Vector quantization is used for bands 1-8, where the number of bits per vector where the number of bits per vector defines the size of the codebook defines the size of the codebook

• The highest band is completely eliminated The highest band is completely eliminated (0 bits are used to code them) in WVQ2 (0 bits are used to code them) in WVQ2 and WVQ4, while the highest three bands and WVQ4, while the highest three bands are eliminated in WVQ3 are eliminated in WVQ3

• For WVQ2 and WVQ3, each of the red, For WVQ2 and WVQ3, each of the red, green and blue color planes are green and blue color planes are individually encoded using the parameters individually encoded using the parameters in the tablein the table

Page 225: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 225225

Page 226: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 226226

Page 227: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 227227

Figure 10.3.23 Wavelet/Vector Quantization (WVQ) Compression Example (contd)

h) WVQ4 compression ratio 36:1 i) Error of image (h)

Page 228: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 228228

• The JPEG2000 standard is also based The JPEG2000 standard is also based on the wavelet transform on the wavelet transform

• It provides high quality images at very It provides high quality images at very high compression ratios high compression ratios

• The committee that developed the The committee that developed the standard had certain goals for standard had certain goals for JPEG2000 JPEG2000

Page 229: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 229229

• The goals are as follows:The goals are as follows:

1.1. To provide better compression than the To provide better compression than the DCT-based JPEG algorithmDCT-based JPEG algorithm

2.2. To allow for progressive transmission of To allow for progressive transmission of high quality imageshigh quality images

3.3. To be able to compress binary and To be able to compress binary and continuous tone images by allowing 1 to continuous tone images by allowing 1 to 16 bits for image components 16 bits for image components

Page 230: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 230230

4.4. To allow random access to subimagesTo allow random access to subimages 5.5. To be robust to transmission errors To be robust to transmission errors

6.6. To allow for sequentially image encodingTo allow for sequentially image encoding

• The JPEG2000 compression method The JPEG2000 compression method begins by level shifting the data to center begins by level shifting the data to center it at zero, followed by an optional it at zero, followed by an optional transform to decorrelate the data, such transform to decorrelate the data, such as a color transform for color imagesas a color transform for color images

Page 231: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 231231

• The one-dimensional wavelet transform is The one-dimensional wavelet transform is applied to the rows and columns, and the applied to the rows and columns, and the coefficients are quantized based on the coefficients are quantized based on the image size and number of wavelet bands image size and number of wavelet bands utilized utilized

• These quantized coefficients are then These quantized coefficients are then arithmetically coded on a bitplane basisarithmetically coded on a bitplane basis

Page 232: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 232232

Figure 10.3-24: The JPEG2000 Algorithm Applied to a Color Image

a) The original image

Page 233: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 233233

Figure 10.3-24: The JPEG2000 Algorithm Applied to a Color Image (contd)

c) Compression ratio = 200, compare to Fig10.3-21f

b) Compression ratio = 130 , compare to Fig10.3-21e (next slide)

Page 234: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 234234

Figure 10.3-21:The Original DCT-based JPEG Algorithm Applied to a Color Image (contd)

f) Compression ratio = 201.39e) Compression ratio = 131.03

Page 235: Chapter 10 Image Compression

(c) Scott E Umbaugh, SIUE 2005(c) Scott E Umbaugh, SIUE 2005 235235

Figure 10.3-24: The JPEG2000 Algorithm Applied to a Color Image (contd)

e) A 128x128 subimage cropped from the JPEG2000 image and enlarged to 256x256 using zero order hold

d) A 128x128 subimage cropped from the standard JPEG image and enlarged to 256x256 using zero-order hold

Note: The JPEG2000 image is much smoother, even with the zero-order hold enlargement