Any Differences?
Lecture by Kalyan Acharjya
1
Disclaimer
Lecture by Kalyan Acharjya
2
 All images/contents used in this presentation are
copyright of original owners.
 The PPT has prepared for academic use only.
So True?
Lecture by Kalyan Acharjya
3
Unit 5
Image Compression
(Part 1)
Kalyan Acharjya
Jaipur National University, Jaipur
Lecture by Kalyan Acharjya
4
JPEG
Lecture by Kalyan Acharjya
Image Compression.
Size-270 KB Size-22 KB
“Without Compression a CD store only 200 Pictures or 8
Seconds Movie”
5
What is Image Compression?
Lecture by Kalyan Acharjya
 Image compression is the process of reducing
the amount of data required to represent an
image.
Encoder 0101100111... Decoder
Original Image Decoded Image
Bitstream
6
Why Compression?
Lecture by Kalyan Acharjya
7
Storage
Ease of Transmission
Compression Fundamentals
Lecture by Kalyan Acharjya
 Image compression involves reducing the size of image
data files, while retaining necessary information
 Retaining necessary information depends upon the
application
 Image segmentation methods, which are primarily a data
reduction process, can be used for compression
 The ratio of the original, uncompressed image file and the
compressed file is referred to as the compression ratio
8
Why Compression?
Lecture by Kalyan Acharjya
 Now, consider the transmission of video images, where we need
multiple frames per second, If we consider just one second of video
data that has been digitized at 640x480 pixels per frame, and requiring
15 frames per second for interlaced video, then:
 Waiting 35 seconds for one second’s worth of video is not exactly real
time.
 Even attempting to transmit uncompressed video over the highest
speed Internet connection is impractical
9
Image Compression General Models
Lecture by Kalyan Acharjya
 Some image Compression Standard
 JPEG-Based on DCT
 JPEG 2000-Based on DWT
 GIF-Graphics Interchange Format etc.
Source
Encoder
Channel
Encoder
Channel
Decoder
Source
Decoder
Channel/
Store
F(x, y)
F’(x, y)
10
Data ≠ Information
Lecture by Kalyan Acharjya
 Data and information are not synonymous terms.
 Data is the means by which information is conveyed.
 Data compression aims to reduce the amount of data required
to represent a given quantity of information while preserving
as much information as possible.
 Image compression is an irreversible process.
 Some Transform used in Image Compression
 DCT-Discrete Cosine Transform
 DWT-Discrete wavelet Transform etc.
11
Lecture by Kalyan Acharjya
Compression Steps
 Preparation: analog to digital conversion.
 Processing: transform data into a domain easier to
compress.
 Quantization: reduce precision at which the output is
stored.
 Entropy Encoding: remove redundant information in the
resulting data stream.
Picture
Preparation
Picture
Processing
Quanti-
zation
Entropy
Encoding
Input Image Compressed Image
12
Image Compression-Lossy or Lossless
Lecture by Kalyan Acharjya
 But its resolution or features should be unchanged for human
perception.
 Relative Data Redundancy Rd of the first data set is Rd=1-1/CR
 Where CR-Compression Ratio=n1/n2.
 n1 and n2 denote the nos. of information carrying units in two data
sets that represent the same information.
• In Digital Image Compression, the basics data redundancies are-
 Coding Redundancy
 Inter pixel Redundancy
 Psycho-visual Redundancy
13
Lecture by Kalyan Acharjya
14
Compression algorithms are developed by taking advantage of the
redundancy that is inherent in image data
Coding Redundancy
 Occurs when the data used to represent the image is not utilized in
an optimal manner
Interpixel Redundancy
 Occurs because adjacent pixels tend to be highly correlated, in
most images the brightness levels do not change rapidly, but
change gradually.
Psychovisual Redundancy
 Some information is more important to the human visual system
than other types of information
Data Redundancies
Lecture by Kalyan Acharjya 15
Part II
Image Compression
Unit V
Trade Off: Quality vs. Compression
Lecture by Kalyan Acharjya
16
 Lossless Compression (Information Preserving) -
Original can be recovered exactly. Higher quality,
bigger.
 Lossy Compression- Only an approximation of
the original can be recovered. Lower quality,
smaller.
Lecture by Kalyan Acharjya
17
Compression algorithms are developed by taking advantage of the
redundancy that is inherent in image data
Coding Redundancy
 Occurs when the data used to represent the image is not utilized in
an optimal manner
Interpixel Redundancy
 Occurs because adjacent pixels tend to be highly correlated, in
most images the brightness levels do not change rapidly, but
change gradually.
Psychovisual Redundancy
 Some information is more important to the human visual system
than other types of information
Data Redundancies
Coding Redundancy
Lecture by Kalyan Acharjya
18
 Length of the code words (e.g., 8-bit codes for grey value
images) is larger than needed.
 Coding redundancy is associated with the representation of
information.
 The information is represented in the form of codes.
 If the gray levels of an image are coded in a way that uses
more code symbols than absolutely necessary to represent
each gray level then the resulting image is said to contain
coding redundancy.
Coding Redundancy
Lecture by Kalyan Acharjya
19
Coding Redundancy
Lecture by Kalyan Acharjya
20
Measuring the
Information
I=Log[1/P(E)]
=-log P(E)
Measuring Information
Lecture by Kalyan Acharjya
21
 These methods, from information theory, are not limited to
images, but apply to any digital information. Here uses
“symbols” instead of “pixel values” and “sources” instead of
“images”
Shanon’s First Theorem
Lecture by Kalyan Acharjya
22
 Shanon looked at group of n consecutive source symbols with a
single code word (rather than one code word per source symbol)
and showed that-
 Where Lavg is the average number of code symbols required to
represents all n symbols groups.
Coding Redundancy
Lecture by Kalyan Acharjya
23
Two common algorithms: Huffman coding and LZW coding
Fidelity Criteria
Lecture by Kalyan Acharjya
24
RMS Error
Lecture by Kalyan Acharjya
25
The rms of the three images are 5.17, 15.67, and 14.17.
Image Compression
Lecture by Kalyan Acharjya
26
Inter-Pixel Redundancy
Lecture by Kalyan Acharjya
27
 Inter-Pixel Spatial Redundancy:
 Inter-pixel redundancy is due to the correlation between the neighboring
pixels in an image.
 The value of any given pixel can be predicated from the value of its
neighbors (Highly Correlated).
 The information carried by individual pixel is relatively small.
 To reduce inter-pixel redundancy the difference between adjacent pixels can
be used to represent an image.
 Inter-Pixel Temporal Redundancy
 Inter-Pixel temporal redundancy is the statistical correlation between pixels
from successive frames in video sequence.
 Temporal redundancy is also called inter-frame redundancy.
 Removing a large amount of redundancy leads to efficient video
compression.
Algorithm: Run Length Coding
Spatial Redundancy
Lecture by Kalyan Acharjya
28
Its Histogram (Ignore White Background)
Just variable length coding is not
sufficient?
0 255
Run Length Algorithm
Lecture by Kalyan Acharjya
29
 Lets Discuss (During Lecture!)
 Consider one Binary Image
 Its vector representation
 Size without compression
 Size after run length algorithm
1 1 1 1 1 1
1 1 1 1 0 0
1 1 1 1 1 1
0 0 1 1 1 1
1 1 1 1 1 1
0 0 0 0 0 0
Which have higher intensity (Centre Circle)?
Lecture by Kalyan Acharjya
30
Psychovisual Redundancy
Lecture by Kalyan Acharjya
31
Psychovisual Redundancy
Lecture by Kalyan Acharjya
32
 The Psychovisual redundancies exist because human perception does not
involve quantitative analysis of every pixel or luminance value in the image.
 It’s elimination is real visual information is possible only because the
information itself is not essential for normal visual processing.
Psychovisual Redundancy
Lecture by Kalyan Acharjya
33
 We’re more sensitive to differences between dark intensities than
bright ones. Encode log(intensity) instead of intensity.
 We’re more sensitive to differences of intensity in green than red
or blue.
 Use variable quantization: devote most bits to green, fewest to
blue.
Some Basic Compression Methods
Lecture by Kalyan Acharjya
34
 Huffman coding (Will Discuss in this Lecture- Coding Redundancy)
 Golomb Coding
 Arithmetic Coding
 LZW Coding
 Run Length Coding (Already Discussed)
 Symbol Based Coding
 Bit Plane Coding (You are familiar)
….many more for detail:
Image Processing Gonzalez Book (Chapter 8-Image Compression)
Huffman Coding
Lecture by Kalyan Acharjya
35
Huffman Coding
Lecture by Kalyan Acharjya
36
Efficiency=H/Lavg x 100 %
Channel Encoder & Decoder
Lecture by Kalyan Acharjya
37
Remember
Lecture by Kalyan Acharjya
38
 To study some standard image compression methods
Like JPG, JPEG2000 etc.
Suggested Further Reading
Gonzalez & Woods, Digital Image
Processing Book
Chapter 8: Image Compression
Thank You!
Any Question Please?
kalyan.acharjya@gmail.com
kalyan5.blogspot.in
Lecture by Kalyan Acharjya 39
Suggested Further Reading
Gonzalez & Woods, Digital Image Processing Book
Chapter 8: Image Compression

Introduction to Image Compression

  • 1.
    Any Differences? Lecture byKalyan Acharjya 1
  • 2.
    Disclaimer Lecture by KalyanAcharjya 2  All images/contents used in this presentation are copyright of original owners.  The PPT has prepared for academic use only.
  • 3.
    So True? Lecture byKalyan Acharjya 3
  • 4.
    Unit 5 Image Compression (Part1) Kalyan Acharjya Jaipur National University, Jaipur Lecture by Kalyan Acharjya 4
  • 5.
    JPEG Lecture by KalyanAcharjya Image Compression. Size-270 KB Size-22 KB “Without Compression a CD store only 200 Pictures or 8 Seconds Movie” 5
  • 6.
    What is ImageCompression? Lecture by Kalyan Acharjya  Image compression is the process of reducing the amount of data required to represent an image. Encoder 0101100111... Decoder Original Image Decoded Image Bitstream 6
  • 7.
    Why Compression? Lecture byKalyan Acharjya 7 Storage Ease of Transmission
  • 8.
    Compression Fundamentals Lecture byKalyan Acharjya  Image compression involves reducing the size of image data files, while retaining necessary information  Retaining necessary information depends upon the application  Image segmentation methods, which are primarily a data reduction process, can be used for compression  The ratio of the original, uncompressed image file and the compressed file is referred to as the compression ratio 8
  • 9.
    Why Compression? Lecture byKalyan Acharjya  Now, consider the transmission of video images, where we need multiple frames per second, If we consider just one second of video data that has been digitized at 640x480 pixels per frame, and requiring 15 frames per second for interlaced video, then:  Waiting 35 seconds for one second’s worth of video is not exactly real time.  Even attempting to transmit uncompressed video over the highest speed Internet connection is impractical 9
  • 10.
    Image Compression GeneralModels Lecture by Kalyan Acharjya  Some image Compression Standard  JPEG-Based on DCT  JPEG 2000-Based on DWT  GIF-Graphics Interchange Format etc. Source Encoder Channel Encoder Channel Decoder Source Decoder Channel/ Store F(x, y) F’(x, y) 10
  • 11.
    Data ≠ Information Lectureby Kalyan Acharjya  Data and information are not synonymous terms.  Data is the means by which information is conveyed.  Data compression aims to reduce the amount of data required to represent a given quantity of information while preserving as much information as possible.  Image compression is an irreversible process.  Some Transform used in Image Compression  DCT-Discrete Cosine Transform  DWT-Discrete wavelet Transform etc. 11
  • 12.
    Lecture by KalyanAcharjya Compression Steps  Preparation: analog to digital conversion.  Processing: transform data into a domain easier to compress.  Quantization: reduce precision at which the output is stored.  Entropy Encoding: remove redundant information in the resulting data stream. Picture Preparation Picture Processing Quanti- zation Entropy Encoding Input Image Compressed Image 12
  • 13.
    Image Compression-Lossy orLossless Lecture by Kalyan Acharjya  But its resolution or features should be unchanged for human perception.  Relative Data Redundancy Rd of the first data set is Rd=1-1/CR  Where CR-Compression Ratio=n1/n2.  n1 and n2 denote the nos. of information carrying units in two data sets that represent the same information. • In Digital Image Compression, the basics data redundancies are-  Coding Redundancy  Inter pixel Redundancy  Psycho-visual Redundancy 13
  • 14.
    Lecture by KalyanAcharjya 14 Compression algorithms are developed by taking advantage of the redundancy that is inherent in image data Coding Redundancy  Occurs when the data used to represent the image is not utilized in an optimal manner Interpixel Redundancy  Occurs because adjacent pixels tend to be highly correlated, in most images the brightness levels do not change rapidly, but change gradually. Psychovisual Redundancy  Some information is more important to the human visual system than other types of information Data Redundancies
  • 15.
    Lecture by KalyanAcharjya 15 Part II Image Compression Unit V
  • 16.
    Trade Off: Qualityvs. Compression Lecture by Kalyan Acharjya 16  Lossless Compression (Information Preserving) - Original can be recovered exactly. Higher quality, bigger.  Lossy Compression- Only an approximation of the original can be recovered. Lower quality, smaller.
  • 17.
    Lecture by KalyanAcharjya 17 Compression algorithms are developed by taking advantage of the redundancy that is inherent in image data Coding Redundancy  Occurs when the data used to represent the image is not utilized in an optimal manner Interpixel Redundancy  Occurs because adjacent pixels tend to be highly correlated, in most images the brightness levels do not change rapidly, but change gradually. Psychovisual Redundancy  Some information is more important to the human visual system than other types of information Data Redundancies
  • 18.
    Coding Redundancy Lecture byKalyan Acharjya 18  Length of the code words (e.g., 8-bit codes for grey value images) is larger than needed.  Coding redundancy is associated with the representation of information.  The information is represented in the form of codes.  If the gray levels of an image are coded in a way that uses more code symbols than absolutely necessary to represent each gray level then the resulting image is said to contain coding redundancy.
  • 19.
    Coding Redundancy Lecture byKalyan Acharjya 19
  • 20.
    Coding Redundancy Lecture byKalyan Acharjya 20 Measuring the Information I=Log[1/P(E)] =-log P(E)
  • 21.
    Measuring Information Lecture byKalyan Acharjya 21  These methods, from information theory, are not limited to images, but apply to any digital information. Here uses “symbols” instead of “pixel values” and “sources” instead of “images”
  • 22.
    Shanon’s First Theorem Lectureby Kalyan Acharjya 22  Shanon looked at group of n consecutive source symbols with a single code word (rather than one code word per source symbol) and showed that-  Where Lavg is the average number of code symbols required to represents all n symbols groups.
  • 23.
    Coding Redundancy Lecture byKalyan Acharjya 23 Two common algorithms: Huffman coding and LZW coding
  • 24.
    Fidelity Criteria Lecture byKalyan Acharjya 24
  • 25.
    RMS Error Lecture byKalyan Acharjya 25 The rms of the three images are 5.17, 15.67, and 14.17.
  • 26.
    Image Compression Lecture byKalyan Acharjya 26
  • 27.
    Inter-Pixel Redundancy Lecture byKalyan Acharjya 27  Inter-Pixel Spatial Redundancy:  Inter-pixel redundancy is due to the correlation between the neighboring pixels in an image.  The value of any given pixel can be predicated from the value of its neighbors (Highly Correlated).  The information carried by individual pixel is relatively small.  To reduce inter-pixel redundancy the difference between adjacent pixels can be used to represent an image.  Inter-Pixel Temporal Redundancy  Inter-Pixel temporal redundancy is the statistical correlation between pixels from successive frames in video sequence.  Temporal redundancy is also called inter-frame redundancy.  Removing a large amount of redundancy leads to efficient video compression. Algorithm: Run Length Coding
  • 28.
    Spatial Redundancy Lecture byKalyan Acharjya 28 Its Histogram (Ignore White Background) Just variable length coding is not sufficient? 0 255
  • 29.
    Run Length Algorithm Lectureby Kalyan Acharjya 29  Lets Discuss (During Lecture!)  Consider one Binary Image  Its vector representation  Size without compression  Size after run length algorithm 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0
  • 30.
    Which have higherintensity (Centre Circle)? Lecture by Kalyan Acharjya 30
  • 31.
  • 32.
    Psychovisual Redundancy Lecture byKalyan Acharjya 32  The Psychovisual redundancies exist because human perception does not involve quantitative analysis of every pixel or luminance value in the image.  It’s elimination is real visual information is possible only because the information itself is not essential for normal visual processing.
  • 33.
    Psychovisual Redundancy Lecture byKalyan Acharjya 33  We’re more sensitive to differences between dark intensities than bright ones. Encode log(intensity) instead of intensity.  We’re more sensitive to differences of intensity in green than red or blue.  Use variable quantization: devote most bits to green, fewest to blue.
  • 34.
    Some Basic CompressionMethods Lecture by Kalyan Acharjya 34  Huffman coding (Will Discuss in this Lecture- Coding Redundancy)  Golomb Coding  Arithmetic Coding  LZW Coding  Run Length Coding (Already Discussed)  Symbol Based Coding  Bit Plane Coding (You are familiar) ….many more for detail: Image Processing Gonzalez Book (Chapter 8-Image Compression)
  • 35.
    Huffman Coding Lecture byKalyan Acharjya 35
  • 36.
    Huffman Coding Lecture byKalyan Acharjya 36 Efficiency=H/Lavg x 100 %
  • 37.
    Channel Encoder &Decoder Lecture by Kalyan Acharjya 37
  • 38.
    Remember Lecture by KalyanAcharjya 38  To study some standard image compression methods Like JPG, JPEG2000 etc. Suggested Further Reading Gonzalez & Woods, Digital Image Processing Book Chapter 8: Image Compression
  • 39.
    Thank You! Any QuestionPlease? [email protected] kalyan5.blogspot.in Lecture by Kalyan Acharjya 39 Suggested Further Reading Gonzalez & Woods, Digital Image Processing Book Chapter 8: Image Compression