This document provides an overview of image compression techniques. It defines key concepts like pixels, image resolution, and types of images. It then explains the need for compression to reduce file sizes and transmission times. The main compression methods discussed are lossless techniques like run-length encoding and Huffman coding, as well as lossy methods for images (JPEG) and video (MPEG) that remove redundant data. Applications of image compression include transmitting images over the internet faster and storing more photos on devices.
2. Image:
• An image is a two dimensional signal. It is
defined by the mathematical function f(x,y)
• where x and y are the two coordinates
horizontally and vertically.
Pixel:
• The value of f(x,y) at any point is gives the
pixel value at that point of an image.
Image Resolution:
• It refers to number of pixels in an image
3. Types of image
Binary image:
it contain only two pixel value o or 1
Gray scale image:
it has 256 different shades of colors in it, and
ranges from 0 to 255
RGB Image/color image:
for 8 bit format – it ranges from 0 to 255
For 16 bit format – it ranges from 0 to 65535
4. What is Compression
Reduce the size of data.
Compression is a way to reduce the number of bits in a
frame but retaining its meaning.
Image compression can benefit users by having pictures
load faster and web pages use up less space on a Web
host.
Image compression does not reduce the physical size of
an image but instead compresses the data that makes up
the image into a smaller size.
5. Need for compression
• To understand the need for compact image
representation, consider the amount of data
required to represent a 2 hour Standard
Definition (SD) using 720 x 480 x 24 bit pixel
arrays.
• A video is a sequence of video frames where each
frame is a full color still image.
• Because video player must display the frames
sequentially at rates near 30fps, SD video data
must be accessed at
• 30fps x (720x480)ppf x 3bpp = 31,104,000 bps
6. • Thus a 2 hour movie consists of
• 31,104,000 bps x (602) sph x 2 hrs ≈ 2.24 x 1011
bytes.
OR
224GB of data
• sph = second per hour
• Twenty seven 8.5GB dual layer DVDs are needed to
store it.
• To put a 2hr movie on a single DVD, each frame
must be compressed by a factor of around 26.3.
• The compression must be even higher for HD,
where image resolution reach 1920 x 1080 x 24
bits/image
7. • Web page images & High-resolution digital camera
photos also are also compressed to save storage
space & reduce transmission time.
• Residential Internet connection delivers data at
speeds ranging from 56kbps (conventional phone
line) to more than 12mbps (broadband).
• Time required to transmit a small 128 x 128 x 24 bit
full color image over this range of speed is from 7.0
to 0.03 sec.
• Compression can reduce the transmission time by a
factor of around 2 to 10 or more.
• Similarly, number of uncompressed full color images
that an 8 Megapixel digital camera can store on a
1GB Memory card can be increased.
10. Lossless Compression:
When a file that has been compressed can be
decoded back into its original form with zero loss of
information, the compression is said to be a Lossless
Compression
Lossy Compression:
If, after compression, the original file cannot be
brought back again then the compression is said to
be Lossy
11. Method 1:Run-length encoding
• Simplest method of compression.
• How: replace consecutive repeating occurrences of a symbol
by 1 occurrence of the symbol itself, then followed by the
number of occurrences.
• The method can be more efficient if the data uses only 2
symbols (0s and 1s) in bit patterns and 1 symbol is more
frequent than another.
12. Method 2:Huffman Coding
Assign fewer bits to symbols that occur more frequently and
more bits to symbols appear less often.
There’s no unique Huffman code and every Huffman code has
the same average code length.
Algorithm:
① Make a leaf node for each code symbol
Add the generation probability of each symbol to the leaf node
② Take the two leaf nodes with the smallest probability and connect them into
a new node
Add 1 or 0 to each of the two branches
The probability of the new node is the sum of the probabilities of the
two connecting nodes
③ If there is only one node left, the code construction is completed. If not, go
back to (2)
14. How the encoding and decoding process
takes place?
• Encoding:
• Decoding:
15. Method 3:Lempel Ziv Encoding
• It is dictionary-based encoding
• Basic idea:
Create a dictionary(a table) of strings used during
communication.
If both sender and receiver have a copy of the
dictionary, then previously-encountered strings can be
substituted by their index in the dictionary.
16. Contd...,
This compression has 2 phases:
Building an indexed dictionary
Compressing a string of symbols
• Algorithm for lempel ziv encoding:
Extract the smallest substring that cannot be found in the
remaining uncompressed string.
Store that substring in the dictionary as a new entry and
assign it an index value
Substring is replaced with the index found in the
dictionary
Insert the index and the last character of the substring
into the compressed string
17. Lossy Compression
• Lossy compression is the converse of lossless data
compression.
• It is Used for compressing images and video files.
• Methods of lossy compression:
JPEG: compress pictures and graphics
MPEG:compress video
MP3: compress audio
18. Method 1:JPEG Encoding
• Used to compress pictures and graphics.
• In JPEG, a grayscale picture is divided into 8x8 pixel
blocks to decrease the number of calculations.
• Basic idea:
Change the picture into a linear (vector) sets of numbers that
reveals the redundancies.
The redundancies is then removed by one of lossless.
19. JPEG Encoding- DCT
• DCT: Discrete Concise Transform
• DCT transforms the 64 values in 8x8 pixel block in a way that
the relative relationships between pixels are kept but the
redundancies are revealed.
• Example:
A gradient grayscale
20. Quantization & Compression
Quantization:
After T table is created, the values are quantized to
reduce the number of bits needed for encoding.
Quantization divides the number of bits by a constant,
then drops the fraction. This is done to optimize the
number of bits and the number of 0s for each particular
application.
• Compression:
Quantized values are read from the table and redundant
0s are removed.
To cluster the 0s together, the table is read diagonally in
an zigzag fashion. The reason is if the table doesn’t have
fine changes, the bottom right corner of the table is all 0s.
JPEG usually uses lossless run-length encoding at the
compression phase.
22. Method 2:MPEG Encoding
• Used to compress video.
• Basic idea:
Each video is a rapid sequence of a set of frames. Each
frame is a spatial combination of pixels, or a picture.
Compressing video =
spatially compressing each frame
+
temporally compressing a set of frames.
23. Types of MPEG compression
• Spatial Compression
Each frame is spatially compressed by JPEG.
• Temporal Compression
Redundant frames are removed.
For example, in a static scene in which someone is talking, most
frames are the same except for the segment around the speaker’s
lips, which changes from one frame to the next.
24. Advantages
• Used in remote sensing
• In space exploration
• Geological surveys for detecting mineral
resources
In industries