SlideShare a Scribd company logo
Image Compression
Goal
 Store image data as efficiently as possible
 Ideally, want to
– Maximize image quality
– Minimize storage space and processing resources
 Can’t have best of both worlds
 What are some good compromises?
Why is it possible to compress images?
 Data != information/knowledge
 Data >> information
 Key idea in compression: only keep the info.
 But why is data != info? Answer: Redundancy
 Statistical redundancy
– Spatial redundancy and coding redundancy
 Phychovisual redundancy
– Greyscale redundancy and frequency redundancy
Spatial redundancy
 Pixel values are not spatially independent
 High correlation among neighbor pixels
Coding redundancy
 Redundancy when mapping from the pixels (symbols)
to the final compressed binary code (Information theory)
 Example:
 Lavg,1 = 3 bits/symbol
 Lavg,2 = 4x0.1+2x0.2+0.5+4x0.05+3x0.15 = 1.95 bits/sym
 Code 2 is also unique and shorter
Phychovisual redundancy
 The ”end-user” is a human => only represent the info.
which can be perceived by the Human Visual System
(HSV)
 From a data’s point of view => lossy
 From the HSV’s point of view => lossless
 Intensity redundancy
 Frequency redundancy
Low-level
Processing
unit
Incident
light
Preceived visual
information
High-level
Processing
unit
Intensity redundancy
 Weber’s law: ∆I / I1 ~ constant
∆I = I1 – I2, where just recognizable
 The high (bright) values need
a less accurate representation
compared to the low (dark) values
 Weber’s law holds for all
human senses!
I2
I1
Sound
∆I
∆I
Noise level
I2
I2
I1
I1
Frequency redundancy
 Human eye functions as a lowpass filter =>
– High frequencies in an image can be ”ignored” without the
HVS noticing
– Key issue in lossy image compression
 Now we know why image compression is possible:
Redundancies
 Investigate how to implement these redundancies
in algorithms
Two main schools of image
compression
 Lossless
– Stored image data can
reproduce original image
exactly
– Takes more storage
space
– Uses entropy coding only
(or none at all)
– Examples: BMP, TIFF,
GIF
 Lossy
– Stored image data can
reproduce something that
looks “close” to the
original image
– Uses both quantization
and entropy coding
– Usually involves transform
into frequency or other
domain
– Examples: JPEG, JPEG-
2000
Concepts
 Lossless compression
– Astronomy, medicine => details
 Lossy compression
– ”normal” images => overall
 An image: 2D array of pixels (rows, columns)
– A pixel value:
 Greyscale/intensity: [8 bits]
 Color: [3 x 8 bits] [Red, Green, Blue] [R,G,B]
– Data:
 Greyscale: 300x300 = 90.000 pixels = 90Kbyte = 720Kbit
 Color: x3 = 270Kbyte = 2.16Mbit
BMP (Bitmap)
 Use 3 bytes per pixel, one
each for R, G, and B
 Can represent up to 224
= 16.7
million colors
 No entropy coding
 File size in bytes =
3*length*height, which can be
very large
 Can use fewer than 8 bits per
color, but you need to store
the color palette
 Performs well with ZIP, RAR,
etc.
GIF (Graphics Interchange Format)
 Can use up to 256 colors
from 24-bit RGB color space
– If source image contains
more than 256 colors, need
to reprocess image to fewer
colors
 Suitable for simpler images
such as logos and textual
graphics, not so much for
photographs
 Uses LZW lossless data
compression
JPEG (Joint Photographic Experts
Group)
 Most dominant image
format today
 Typical file size is about
10% of that of BMP (can
vary depending on
quality settings)
 Unlike GIF, JPEG is
suitable for photographs,
not so much for logos
and textual graphics
JPEG Encoding Steps
 Preprocess image
 Apply 2D forward DCT
 Quantize DCT coefficients
 Apply RLE, then entropy encoding
JPEG Block Diagram
FDCT
Source
Image
Quantizer
Entropy
Encoder
TableTable
Compressed
image data
DCT-based encoding
8x8 blocks
R
B
G
Preprocess
 Shift values [0, 2P
- 1] to [-2P-1
, 2P-1
- 1]
– e.g. if (P=8), shift [0, 255] to [-127, 127]
– DCT requires range be centered around 0
 Segment each component into 8x8 blocks
 Interleave components (or not)
– may be sampled at different rates
Interleaving
 Non-interleaved: scan from left to right, top to
bottom for each color component
 Interleaved: compute one “unit” from each
color component, then repeat
– full color pixels after each step of decoding
– but components may have different resolution
Color Transformation (optional)
 Down-sample chrominance components
– compress without loss of quality (color space)
– e.g., YUV 4:2:2 or 4:1:1
 Example: 640 x 480 RGB to YUV 4:1:1
– Y is 640x480
– U is 160x120
– V is 160x120
Interleaving
 ith color component has dimension (xi, yi)
– maximum dimension value is 216
– [X, Y] where X=max(xi) and Y=max(yi)
 Sampling among components must be integral
– Hi and Vi; must be within range [1, 4]
– [Hmax, Vmax] where Hmax=max(Hi) and Vmax=max(Vi)
 xi = X * Hi / Hmax
 yi = Y * Vi / Vmax
Example
[Wallace, 1991]
Forward DCT
 Convert from spatial to frequency domain
– convert intensity function into weighted sum of
periodic basis (cosine) functions
– identify bands of spectral information that can be
thrown away without loss of quality
 Intensity values in each color plane often
change slowly
Understanding DCT
 For example, in R3
, we can write (5, 2, 9) as the
sum of a set of basis vectors
– we know that [(1,0,0), (0,1,0), (0,0,1)] provides one
set of basis functions in R3
(5,2,9) = 5*(1,0,0) + 2*(0,1,0) + 9*(0,0,1)
 DCT is same process in function domain
DCT Basic Functions
 Decompose the intensity function into a
weighted sum of cosine basis functions
Alternative Visualization
1D Forward DCT
 Given a list of n intensity values I(x),
where x = 0, …, N-1
 Compute the N DCT coefficients:
1...0,
2
)12(
cos)()(
2
)(
1
0
−=
+
= ∑
−
=
nu
n
x
xIuC
n
uF
n
x
µπ




=
=
otherwise
ufor
uCwhere
1
,0
2
1
)(
1D Inverse DCT
 Given a list of n DCT coefficients F(u),
where u = 0, …, n-1
 Compute the n intensity values:




=
=
otherwise
ufor
uCwhere
1
,0
2
1
)(
1...0,
2
)12(
cos)()(
2
)(
1
0
−=
+
= ∑
−
=
nx
n
x
uCuF
n
xI
n
u
µπ
Extend DCT from 1D to 2D
 Perform 1D DCT on each
row of the block
 Again for each column of
1D coefficients
– alternatively, transpose
the matrix and perform
DCT on the rows
X
Y
Equations for 2D DCT
 Forward DCT:
 Inverse DCT:





 +





 +
= ∑∑
−
=
−
= m
vy
n
ux
yxIvCuC
nm
vuF
m
y
n
x 2
)12(
cos*
2
)12(
cos*),()()(
2
),(
1
0
1
0
ππ





 +





 +
= ∑∑
−
=
−
= m
vy
n
ux
vCuCuvF
nm
xyI
m
v
n
u 2
)12(
cos*
2
)12(
cos)()(),(
2
),(
1
0
1
0
ππ
Visualization of Basis FunctionsIncreasingfrequency
Increasing frequency
Quantization
 Divide each coefficient by integer [1, 255]
– comes in the form of a table, same size as a block
– multiply the block of coefficients by the table, round result to
nearest integer
 In the decoding process, multiply the quantized
coefficients by the inverse of the table
– get back a number close to original
– error is less than 1/2 of the quantization number
 Larger quantization numbers cause more loss
De facto Quantization Table
16 11 10 16 24 40 51 61
12 12 14 19 26 58 60 55
14 13 16 24 40 57 69 56
14 17 22 29 51 87 80 62
18 22 37 56 68 109 103 77
24 35 55 64 81 104 113 92
49 64 78 87 103 121 120 101
72 92 95 98 112 100 103 99
Eye becomes less sensitive
Eyebecomeslesssensitive
Entropy Encoding
 Compress sequence of quantized DC and AC
coefficients from quantization step
– further increase compression, without loss
 Separate DC from AC components
– DC components change slowly, thus will be
encoded using difference encoding
DC Encoding
 DC represents average intensity of a block
– encode using difference encoding scheme
– use 3x3 pattern of blocks
 Because difference tends to be near zero, can
use less bits in the encoding
– categorize difference into difference classes
– send the index of the difference class, followed by
bits representing the difference
AC Encoding
 Use zig-zag ordering of coefficients
– orders frequency components from low->high
– produce maximal series of 0s at the end
 Apply RLE to ordering
Huffman Encoding
 Sequence of DC difference indices and values
along with RLE of AC coefficients
 Apply Huffman encoding to sequence – Exploits
sequence’s statistics by assigning frequently used
symbols fewer bits than rare symbols
 Attach appropriate headers
 Finally have the JPEG image!
JPEG Decoding Steps
 Basically reverse steps performed in encoding
process
– Parse compressed image data and perform
Huffman decoding to get RLE symbols
– Undo RLE to get DCT coefficient matrix
– Multiply by the quantization matrix
– Take 2-D inverse DCT of this matrix to get
reconstructed image data
Reconstruction Error
 Resulting image is “close” to original image
 Usually measure “closeness” with MSE (Mean
Squared Error) and PSNR (Peak Signal to
Noise Ratio) – Want low MSE and high PSNR
Example - One everyday photo with
file size of 2.76 MB
Example - One everyday photo with
file size of 600 KB
Example - One everyday photo with
file size of 350 KB
Example - One everyday photo with
file size of 240 KB
Example - One everyday photo with
file size of 144 KB
Example - One everyday photo with
file size of 88 KB
Analysis
 Near perfect image at 2.76M, so-so image at 88K
 Sharpness decreases as file size decreases
 False contours visible at 144K and 88K
– Can be fixed by dithering image before quantization
 Which file size is the best?
– No correct answer to this question
– Answer depends upon how strict we are about image quality, what
purpose image is to be used for, and the resources available
Ad

More Related Content

What's hot (20)

Image Compression
Image CompressionImage Compression
Image Compression
Paramjeet Singh Jamwal
 
Image compression introductory presentation
Image compression introductory presentationImage compression introductory presentation
Image compression introductory presentation
Tariq Abbas
 
image compression ppt
image compression pptimage compression ppt
image compression ppt
Shivangi Saxena
 
Image compression .
Image compression .Image compression .
Image compression .
Payal Vishwakarma
 
Image compression
Image compression Image compression
Image compression
GARIMA SHAKYA
 
JPEG
JPEGJPEG
JPEG
RajatKumar471
 
Image compression and jpeg
Image compression and jpegImage compression and jpeg
Image compression and jpeg
theem college of engineering
 
Image compression
Image compressionImage compression
Image compression
°ღ•ŚℋÚßℋÁℳ Пℐğáℳ
 
Multimedia image compression standards
Multimedia image compression standardsMultimedia image compression standards
Multimedia image compression standards
Mazin Alwaaly
 
Presentation of Lossy compression
Presentation of Lossy compressionPresentation of Lossy compression
Presentation of Lossy compression
Omar Ghazi
 
Digital Image Processing - Image Compression
Digital Image Processing - Image CompressionDigital Image Processing - Image Compression
Digital Image Processing - Image Compression
Mathankumar S
 
VII Compression Introduction
VII Compression IntroductionVII Compression Introduction
VII Compression Introduction
sangusajjan
 
Image compression
Image compressionImage compression
Image compression
Huda Seyam
 
Comparison between JPEG(DCT) and JPEG 2000(DWT) compression standards
Comparison between JPEG(DCT) and JPEG 2000(DWT) compression standardsComparison between JPEG(DCT) and JPEG 2000(DWT) compression standards
Comparison between JPEG(DCT) and JPEG 2000(DWT) compression standards
Rishab2612
 
Digital image compression techniques
Digital image compression techniquesDigital image compression techniques
Digital image compression techniques
eSAT Publishing House
 
Image compression
Image compressionImage compression
Image compression
Shiva Krishna Chandra Shekar
 
Design of Image Compression Algorithm using MATLAB
Design of Image Compression Algorithm using MATLABDesign of Image Compression Algorithm using MATLAB
Design of Image Compression Algorithm using MATLAB
IJEEE
 
Jpeg standards
Jpeg   standardsJpeg   standards
Jpeg standards
NikhilBanerjee7
 
Image compression
Image compressionImage compression
Image compression
Bassam Kanber
 
comparision of lossy and lossless image compression using various algorithm
comparision of lossy and lossless image compression using various algorithmcomparision of lossy and lossless image compression using various algorithm
comparision of lossy and lossless image compression using various algorithm
chezhiyan chezhiyan
 
Image compression introductory presentation
Image compression introductory presentationImage compression introductory presentation
Image compression introductory presentation
Tariq Abbas
 
Multimedia image compression standards
Multimedia image compression standardsMultimedia image compression standards
Multimedia image compression standards
Mazin Alwaaly
 
Presentation of Lossy compression
Presentation of Lossy compressionPresentation of Lossy compression
Presentation of Lossy compression
Omar Ghazi
 
Digital Image Processing - Image Compression
Digital Image Processing - Image CompressionDigital Image Processing - Image Compression
Digital Image Processing - Image Compression
Mathankumar S
 
VII Compression Introduction
VII Compression IntroductionVII Compression Introduction
VII Compression Introduction
sangusajjan
 
Image compression
Image compressionImage compression
Image compression
Huda Seyam
 
Comparison between JPEG(DCT) and JPEG 2000(DWT) compression standards
Comparison between JPEG(DCT) and JPEG 2000(DWT) compression standardsComparison between JPEG(DCT) and JPEG 2000(DWT) compression standards
Comparison between JPEG(DCT) and JPEG 2000(DWT) compression standards
Rishab2612
 
Digital image compression techniques
Digital image compression techniquesDigital image compression techniques
Digital image compression techniques
eSAT Publishing House
 
Design of Image Compression Algorithm using MATLAB
Design of Image Compression Algorithm using MATLABDesign of Image Compression Algorithm using MATLAB
Design of Image Compression Algorithm using MATLAB
IJEEE
 
comparision of lossy and lossless image compression using various algorithm
comparision of lossy and lossless image compression using various algorithmcomparision of lossy and lossless image compression using various algorithm
comparision of lossy and lossless image compression using various algorithm
chezhiyan chezhiyan
 

Similar to Why Image compression is Necessary? (20)

JPEG Image Compression
JPEG Image CompressionJPEG Image Compression
JPEG Image Compression
Aishwarya K. M.
 
Image compression 14_04_2020 (1)
Image compression 14_04_2020 (1)Image compression 14_04_2020 (1)
Image compression 14_04_2020 (1)
Joel P
 
Jv2517361741
Jv2517361741Jv2517361741
Jv2517361741
IJERA Editor
 
Jv2517361741
Jv2517361741Jv2517361741
Jv2517361741
IJERA Editor
 
Ch7 031102
Ch7 031102Ch7 031102
Ch7 031102
ziaullahaffan
 
Data compression
Data compressionData compression
Data compression
Chaitanya Belhekar
 
Jpeg
JpegJpeg
Jpeg
Anju Anjujosepj
 
image file format, digital image processing .ppsx
image file format, digital image processing .ppsximage file format, digital image processing .ppsx
image file format, digital image processing .ppsx
NooraldeenAli2
 
image processing for jpeg presentati.ppt
image processing for jpeg presentati.pptimage processing for jpeg presentati.ppt
image processing for jpeg presentati.ppt
naghamallella
 
J017156874
J017156874J017156874
J017156874
IOSR Journals
 
DCT based Steganographic Evaluation parameter analysis in Frequency domain by...
DCT based Steganographic Evaluation parameter analysis in Frequency domain by...DCT based Steganographic Evaluation parameter analysis in Frequency domain by...
DCT based Steganographic Evaluation parameter analysis in Frequency domain by...
IOSR Journals
 
introduction to jpeg for image proce.ppt
introduction to jpeg for image proce.pptintroduction to jpeg for image proce.ppt
introduction to jpeg for image proce.ppt
naghamallella
 
Compressionbasics
CompressionbasicsCompressionbasics
Compressionbasics
Rohini R Iyer
 
Data compression
Data compressionData compression
Data compression
Sherif Abdelfattah
 
Image Compression Digital Image processing
Image Compression Digital Image processingImage Compression Digital Image processing
Image Compression Digital Image processing
MasudAfjal1
 
Unit 3 Image Compression and Segmentation.pptx
Unit 3  Image Compression and Segmentation.pptxUnit 3  Image Compression and Segmentation.pptx
Unit 3 Image Compression and Segmentation.pptx
AmrutaSakhare1
 
Data compression techniques
Data compression techniquesData compression techniques
Data compression techniques
Deep Bhatt
 
Paper id 25201490
Paper id 25201490Paper id 25201490
Paper id 25201490
IJRAT
 
Pipelined Architecture of 2D-DCT, Quantization and ZigZag Process for JPEG Im...
Pipelined Architecture of 2D-DCT, Quantization and ZigZag Process for JPEG Im...Pipelined Architecture of 2D-DCT, Quantization and ZigZag Process for JPEG Im...
Pipelined Architecture of 2D-DCT, Quantization and ZigZag Process for JPEG Im...
VLSICS Design
 
PIPELINED ARCHITECTURE OF 2D-DCT, QUANTIZATION AND ZIGZAG PROCESS FOR JPEG IM...
PIPELINED ARCHITECTURE OF 2D-DCT, QUANTIZATION AND ZIGZAG PROCESS FOR JPEG IM...PIPELINED ARCHITECTURE OF 2D-DCT, QUANTIZATION AND ZIGZAG PROCESS FOR JPEG IM...
PIPELINED ARCHITECTURE OF 2D-DCT, QUANTIZATION AND ZIGZAG PROCESS FOR JPEG IM...
VLSICS Design
 
Image compression 14_04_2020 (1)
Image compression 14_04_2020 (1)Image compression 14_04_2020 (1)
Image compression 14_04_2020 (1)
Joel P
 
image file format, digital image processing .ppsx
image file format, digital image processing .ppsximage file format, digital image processing .ppsx
image file format, digital image processing .ppsx
NooraldeenAli2
 
image processing for jpeg presentati.ppt
image processing for jpeg presentati.pptimage processing for jpeg presentati.ppt
image processing for jpeg presentati.ppt
naghamallella
 
DCT based Steganographic Evaluation parameter analysis in Frequency domain by...
DCT based Steganographic Evaluation parameter analysis in Frequency domain by...DCT based Steganographic Evaluation parameter analysis in Frequency domain by...
DCT based Steganographic Evaluation parameter analysis in Frequency domain by...
IOSR Journals
 
introduction to jpeg for image proce.ppt
introduction to jpeg for image proce.pptintroduction to jpeg for image proce.ppt
introduction to jpeg for image proce.ppt
naghamallella
 
Image Compression Digital Image processing
Image Compression Digital Image processingImage Compression Digital Image processing
Image Compression Digital Image processing
MasudAfjal1
 
Unit 3 Image Compression and Segmentation.pptx
Unit 3  Image Compression and Segmentation.pptxUnit 3  Image Compression and Segmentation.pptx
Unit 3 Image Compression and Segmentation.pptx
AmrutaSakhare1
 
Data compression techniques
Data compression techniquesData compression techniques
Data compression techniques
Deep Bhatt
 
Paper id 25201490
Paper id 25201490Paper id 25201490
Paper id 25201490
IJRAT
 
Pipelined Architecture of 2D-DCT, Quantization and ZigZag Process for JPEG Im...
Pipelined Architecture of 2D-DCT, Quantization and ZigZag Process for JPEG Im...Pipelined Architecture of 2D-DCT, Quantization and ZigZag Process for JPEG Im...
Pipelined Architecture of 2D-DCT, Quantization and ZigZag Process for JPEG Im...
VLSICS Design
 
PIPELINED ARCHITECTURE OF 2D-DCT, QUANTIZATION AND ZIGZAG PROCESS FOR JPEG IM...
PIPELINED ARCHITECTURE OF 2D-DCT, QUANTIZATION AND ZIGZAG PROCESS FOR JPEG IM...PIPELINED ARCHITECTURE OF 2D-DCT, QUANTIZATION AND ZIGZAG PROCESS FOR JPEG IM...
PIPELINED ARCHITECTURE OF 2D-DCT, QUANTIZATION AND ZIGZAG PROCESS FOR JPEG IM...
VLSICS Design
 
Ad

More from Prabhat Kumar (8)

Key distribution code.ppt
Key distribution code.pptKey distribution code.ppt
Key distribution code.ppt
Prabhat Kumar
 
Agility in DevOPS
Agility in DevOPSAgility in DevOPS
Agility in DevOPS
Prabhat Kumar
 
40 points to make Best Place to Work
40 points to make Best Place to Work40 points to make Best Place to Work
40 points to make Best Place to Work
Prabhat Kumar
 
Introduction to Scrum framework
Introduction to Scrum framework   Introduction to Scrum framework
Introduction to Scrum framework
Prabhat Kumar
 
Prabhat kumar scrum alliance-csp_certificate
Prabhat kumar scrum alliance-csp_certificatePrabhat kumar scrum alliance-csp_certificate
Prabhat kumar scrum alliance-csp_certificate
Prabhat Kumar
 
Prabhat kumar scrum alliance-csm_certificate
Prabhat kumar scrum alliance-csm_certificatePrabhat kumar scrum alliance-csm_certificate
Prabhat kumar scrum alliance-csm_certificate
Prabhat Kumar
 
Sprint planning checklist
Sprint planning checklistSprint planning checklist
Sprint planning checklist
Prabhat Kumar
 
ICP-ACC certificate
ICP-ACC certificateICP-ACC certificate
ICP-ACC certificate
Prabhat Kumar
 
Key distribution code.ppt
Key distribution code.pptKey distribution code.ppt
Key distribution code.ppt
Prabhat Kumar
 
40 points to make Best Place to Work
40 points to make Best Place to Work40 points to make Best Place to Work
40 points to make Best Place to Work
Prabhat Kumar
 
Introduction to Scrum framework
Introduction to Scrum framework   Introduction to Scrum framework
Introduction to Scrum framework
Prabhat Kumar
 
Prabhat kumar scrum alliance-csp_certificate
Prabhat kumar scrum alliance-csp_certificatePrabhat kumar scrum alliance-csp_certificate
Prabhat kumar scrum alliance-csp_certificate
Prabhat Kumar
 
Prabhat kumar scrum alliance-csm_certificate
Prabhat kumar scrum alliance-csm_certificatePrabhat kumar scrum alliance-csm_certificate
Prabhat kumar scrum alliance-csm_certificate
Prabhat Kumar
 
Sprint planning checklist
Sprint planning checklistSprint planning checklist
Sprint planning checklist
Prabhat Kumar
 
Ad

Recently uploaded (20)

Template_A3nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
Template_A3nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnTemplate_A3nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
Template_A3nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
cegiver630
 
Flip flop presenation-Presented By Mubahir khan.pptx
Flip flop presenation-Presented By Mubahir khan.pptxFlip flop presenation-Presented By Mubahir khan.pptx
Flip flop presenation-Presented By Mubahir khan.pptx
mubashirkhan45461
 
03 Daniel 2-notes.ppt seminario escatologia
03 Daniel 2-notes.ppt seminario escatologia03 Daniel 2-notes.ppt seminario escatologia
03 Daniel 2-notes.ppt seminario escatologia
Alexander Romero Arosquipa
 
Cleaned_Lecture 6666666_Simulation_I.pdf
Cleaned_Lecture 6666666_Simulation_I.pdfCleaned_Lecture 6666666_Simulation_I.pdf
Cleaned_Lecture 6666666_Simulation_I.pdf
alcinialbob1234
 
LLM finetuning for multiple choice google bert
LLM finetuning for multiple choice google bertLLM finetuning for multiple choice google bert
LLM finetuning for multiple choice google bert
ChadapornK
 
VKS-Python-FIe Handling text CSV Binary.pptx
VKS-Python-FIe Handling text CSV Binary.pptxVKS-Python-FIe Handling text CSV Binary.pptx
VKS-Python-FIe Handling text CSV Binary.pptx
Vinod Srivastava
 
Simple_AI_Explanation_English somplr.pptx
Simple_AI_Explanation_English somplr.pptxSimple_AI_Explanation_English somplr.pptx
Simple_AI_Explanation_English somplr.pptx
ssuser2aa19f
 
Classification_in_Machinee_Learning.pptx
Classification_in_Machinee_Learning.pptxClassification_in_Machinee_Learning.pptx
Classification_in_Machinee_Learning.pptx
wencyjorda88
 
C++_OOPs_DSA1_Presentation_Template.pptx
C++_OOPs_DSA1_Presentation_Template.pptxC++_OOPs_DSA1_Presentation_Template.pptx
C++_OOPs_DSA1_Presentation_Template.pptx
aquibnoor22079
 
Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...
Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...
Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...
gmuir1066
 
GenAI for Quant Analytics: survey-analytics.ai
GenAI for Quant Analytics: survey-analytics.aiGenAI for Quant Analytics: survey-analytics.ai
GenAI for Quant Analytics: survey-analytics.ai
Inspirient
 
1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf
1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf
1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf
Simran112433
 
Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..
yuvarajreddy2002
 
Digilocker under workingProcess Flow.pptx
Digilocker  under workingProcess Flow.pptxDigilocker  under workingProcess Flow.pptx
Digilocker under workingProcess Flow.pptx
satnamsadguru491
 
DPR_Expert_Recruitment_notice_Revised.pdf
DPR_Expert_Recruitment_notice_Revised.pdfDPR_Expert_Recruitment_notice_Revised.pdf
DPR_Expert_Recruitment_notice_Revised.pdf
inmishra17121973
 
IAS-slides2-ia-aaaaaaaaaaain-business.pdf
IAS-slides2-ia-aaaaaaaaaaain-business.pdfIAS-slides2-ia-aaaaaaaaaaain-business.pdf
IAS-slides2-ia-aaaaaaaaaaain-business.pdf
mcgardenlevi9
 
Developing Security Orchestration, Automation, and Response Applications
Developing Security Orchestration, Automation, and Response ApplicationsDeveloping Security Orchestration, Automation, and Response Applications
Developing Security Orchestration, Automation, and Response Applications
VICTOR MAESTRE RAMIREZ
 
AI Competitor Analysis: How to Monitor and Outperform Your Competitors
AI Competitor Analysis: How to Monitor and Outperform Your CompetitorsAI Competitor Analysis: How to Monitor and Outperform Your Competitors
AI Competitor Analysis: How to Monitor and Outperform Your Competitors
Contify
 
Molecular methods diagnostic and monitoring of infection - Repaired.pptx
Molecular methods diagnostic and monitoring of infection  -  Repaired.pptxMolecular methods diagnostic and monitoring of infection  -  Repaired.pptx
Molecular methods diagnostic and monitoring of infection - Repaired.pptx
7tzn7x5kky
 
VKS-Python Basics for Beginners and advance.pptx
VKS-Python Basics for Beginners and advance.pptxVKS-Python Basics for Beginners and advance.pptx
VKS-Python Basics for Beginners and advance.pptx
Vinod Srivastava
 
Template_A3nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
Template_A3nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnTemplate_A3nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
Template_A3nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
cegiver630
 
Flip flop presenation-Presented By Mubahir khan.pptx
Flip flop presenation-Presented By Mubahir khan.pptxFlip flop presenation-Presented By Mubahir khan.pptx
Flip flop presenation-Presented By Mubahir khan.pptx
mubashirkhan45461
 
Cleaned_Lecture 6666666_Simulation_I.pdf
Cleaned_Lecture 6666666_Simulation_I.pdfCleaned_Lecture 6666666_Simulation_I.pdf
Cleaned_Lecture 6666666_Simulation_I.pdf
alcinialbob1234
 
LLM finetuning for multiple choice google bert
LLM finetuning for multiple choice google bertLLM finetuning for multiple choice google bert
LLM finetuning for multiple choice google bert
ChadapornK
 
VKS-Python-FIe Handling text CSV Binary.pptx
VKS-Python-FIe Handling text CSV Binary.pptxVKS-Python-FIe Handling text CSV Binary.pptx
VKS-Python-FIe Handling text CSV Binary.pptx
Vinod Srivastava
 
Simple_AI_Explanation_English somplr.pptx
Simple_AI_Explanation_English somplr.pptxSimple_AI_Explanation_English somplr.pptx
Simple_AI_Explanation_English somplr.pptx
ssuser2aa19f
 
Classification_in_Machinee_Learning.pptx
Classification_in_Machinee_Learning.pptxClassification_in_Machinee_Learning.pptx
Classification_in_Machinee_Learning.pptx
wencyjorda88
 
C++_OOPs_DSA1_Presentation_Template.pptx
C++_OOPs_DSA1_Presentation_Template.pptxC++_OOPs_DSA1_Presentation_Template.pptx
C++_OOPs_DSA1_Presentation_Template.pptx
aquibnoor22079
 
Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...
Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...
Adobe Analytics NOAM Central User Group April 2025 Agent AI: Uncovering the S...
gmuir1066
 
GenAI for Quant Analytics: survey-analytics.ai
GenAI for Quant Analytics: survey-analytics.aiGenAI for Quant Analytics: survey-analytics.ai
GenAI for Quant Analytics: survey-analytics.ai
Inspirient
 
1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf
1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf
1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf
Simran112433
 
Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..
yuvarajreddy2002
 
Digilocker under workingProcess Flow.pptx
Digilocker  under workingProcess Flow.pptxDigilocker  under workingProcess Flow.pptx
Digilocker under workingProcess Flow.pptx
satnamsadguru491
 
DPR_Expert_Recruitment_notice_Revised.pdf
DPR_Expert_Recruitment_notice_Revised.pdfDPR_Expert_Recruitment_notice_Revised.pdf
DPR_Expert_Recruitment_notice_Revised.pdf
inmishra17121973
 
IAS-slides2-ia-aaaaaaaaaaain-business.pdf
IAS-slides2-ia-aaaaaaaaaaain-business.pdfIAS-slides2-ia-aaaaaaaaaaain-business.pdf
IAS-slides2-ia-aaaaaaaaaaain-business.pdf
mcgardenlevi9
 
Developing Security Orchestration, Automation, and Response Applications
Developing Security Orchestration, Automation, and Response ApplicationsDeveloping Security Orchestration, Automation, and Response Applications
Developing Security Orchestration, Automation, and Response Applications
VICTOR MAESTRE RAMIREZ
 
AI Competitor Analysis: How to Monitor and Outperform Your Competitors
AI Competitor Analysis: How to Monitor and Outperform Your CompetitorsAI Competitor Analysis: How to Monitor and Outperform Your Competitors
AI Competitor Analysis: How to Monitor and Outperform Your Competitors
Contify
 
Molecular methods diagnostic and monitoring of infection - Repaired.pptx
Molecular methods diagnostic and monitoring of infection  -  Repaired.pptxMolecular methods diagnostic and monitoring of infection  -  Repaired.pptx
Molecular methods diagnostic and monitoring of infection - Repaired.pptx
7tzn7x5kky
 
VKS-Python Basics for Beginners and advance.pptx
VKS-Python Basics for Beginners and advance.pptxVKS-Python Basics for Beginners and advance.pptx
VKS-Python Basics for Beginners and advance.pptx
Vinod Srivastava
 

Why Image compression is Necessary?

  • 2. Goal  Store image data as efficiently as possible  Ideally, want to – Maximize image quality – Minimize storage space and processing resources  Can’t have best of both worlds  What are some good compromises?
  • 3. Why is it possible to compress images?  Data != information/knowledge  Data >> information  Key idea in compression: only keep the info.  But why is data != info? Answer: Redundancy  Statistical redundancy – Spatial redundancy and coding redundancy  Phychovisual redundancy – Greyscale redundancy and frequency redundancy
  • 4. Spatial redundancy  Pixel values are not spatially independent  High correlation among neighbor pixels
  • 5. Coding redundancy  Redundancy when mapping from the pixels (symbols) to the final compressed binary code (Information theory)  Example:  Lavg,1 = 3 bits/symbol  Lavg,2 = 4x0.1+2x0.2+0.5+4x0.05+3x0.15 = 1.95 bits/sym  Code 2 is also unique and shorter
  • 6. Phychovisual redundancy  The ”end-user” is a human => only represent the info. which can be perceived by the Human Visual System (HSV)  From a data’s point of view => lossy  From the HSV’s point of view => lossless  Intensity redundancy  Frequency redundancy Low-level Processing unit Incident light Preceived visual information High-level Processing unit
  • 7. Intensity redundancy  Weber’s law: ∆I / I1 ~ constant ∆I = I1 – I2, where just recognizable  The high (bright) values need a less accurate representation compared to the low (dark) values  Weber’s law holds for all human senses! I2 I1 Sound ∆I ∆I Noise level I2 I2 I1 I1
  • 8. Frequency redundancy  Human eye functions as a lowpass filter => – High frequencies in an image can be ”ignored” without the HVS noticing – Key issue in lossy image compression  Now we know why image compression is possible: Redundancies  Investigate how to implement these redundancies in algorithms
  • 9. Two main schools of image compression  Lossless – Stored image data can reproduce original image exactly – Takes more storage space – Uses entropy coding only (or none at all) – Examples: BMP, TIFF, GIF  Lossy – Stored image data can reproduce something that looks “close” to the original image – Uses both quantization and entropy coding – Usually involves transform into frequency or other domain – Examples: JPEG, JPEG- 2000
  • 10. Concepts  Lossless compression – Astronomy, medicine => details  Lossy compression – ”normal” images => overall  An image: 2D array of pixels (rows, columns) – A pixel value:  Greyscale/intensity: [8 bits]  Color: [3 x 8 bits] [Red, Green, Blue] [R,G,B] – Data:  Greyscale: 300x300 = 90.000 pixels = 90Kbyte = 720Kbit  Color: x3 = 270Kbyte = 2.16Mbit
  • 11. BMP (Bitmap)  Use 3 bytes per pixel, one each for R, G, and B  Can represent up to 224 = 16.7 million colors  No entropy coding  File size in bytes = 3*length*height, which can be very large  Can use fewer than 8 bits per color, but you need to store the color palette  Performs well with ZIP, RAR, etc.
  • 12. GIF (Graphics Interchange Format)  Can use up to 256 colors from 24-bit RGB color space – If source image contains more than 256 colors, need to reprocess image to fewer colors  Suitable for simpler images such as logos and textual graphics, not so much for photographs  Uses LZW lossless data compression
  • 13. JPEG (Joint Photographic Experts Group)  Most dominant image format today  Typical file size is about 10% of that of BMP (can vary depending on quality settings)  Unlike GIF, JPEG is suitable for photographs, not so much for logos and textual graphics
  • 14. JPEG Encoding Steps  Preprocess image  Apply 2D forward DCT  Quantize DCT coefficients  Apply RLE, then entropy encoding
  • 16. Preprocess  Shift values [0, 2P - 1] to [-2P-1 , 2P-1 - 1] – e.g. if (P=8), shift [0, 255] to [-127, 127] – DCT requires range be centered around 0  Segment each component into 8x8 blocks  Interleave components (or not) – may be sampled at different rates
  • 17. Interleaving  Non-interleaved: scan from left to right, top to bottom for each color component  Interleaved: compute one “unit” from each color component, then repeat – full color pixels after each step of decoding – but components may have different resolution
  • 18. Color Transformation (optional)  Down-sample chrominance components – compress without loss of quality (color space) – e.g., YUV 4:2:2 or 4:1:1  Example: 640 x 480 RGB to YUV 4:1:1 – Y is 640x480 – U is 160x120 – V is 160x120
  • 19. Interleaving  ith color component has dimension (xi, yi) – maximum dimension value is 216 – [X, Y] where X=max(xi) and Y=max(yi)  Sampling among components must be integral – Hi and Vi; must be within range [1, 4] – [Hmax, Vmax] where Hmax=max(Hi) and Vmax=max(Vi)  xi = X * Hi / Hmax  yi = Y * Vi / Vmax
  • 21. Forward DCT  Convert from spatial to frequency domain – convert intensity function into weighted sum of periodic basis (cosine) functions – identify bands of spectral information that can be thrown away without loss of quality  Intensity values in each color plane often change slowly
  • 22. Understanding DCT  For example, in R3 , we can write (5, 2, 9) as the sum of a set of basis vectors – we know that [(1,0,0), (0,1,0), (0,0,1)] provides one set of basis functions in R3 (5,2,9) = 5*(1,0,0) + 2*(0,1,0) + 9*(0,0,1)  DCT is same process in function domain
  • 23. DCT Basic Functions  Decompose the intensity function into a weighted sum of cosine basis functions
  • 25. 1D Forward DCT  Given a list of n intensity values I(x), where x = 0, …, N-1  Compute the N DCT coefficients: 1...0, 2 )12( cos)()( 2 )( 1 0 −= + = ∑ − = nu n x xIuC n uF n x µπ     = = otherwise ufor uCwhere 1 ,0 2 1 )(
  • 26. 1D Inverse DCT  Given a list of n DCT coefficients F(u), where u = 0, …, n-1  Compute the n intensity values:     = = otherwise ufor uCwhere 1 ,0 2 1 )( 1...0, 2 )12( cos)()( 2 )( 1 0 −= + = ∑ − = nx n x uCuF n xI n u µπ
  • 27. Extend DCT from 1D to 2D  Perform 1D DCT on each row of the block  Again for each column of 1D coefficients – alternatively, transpose the matrix and perform DCT on the rows X Y
  • 28. Equations for 2D DCT  Forward DCT:  Inverse DCT:       +       + = ∑∑ − = − = m vy n ux yxIvCuC nm vuF m y n x 2 )12( cos* 2 )12( cos*),()()( 2 ),( 1 0 1 0 ππ       +       + = ∑∑ − = − = m vy n ux vCuCuvF nm xyI m v n u 2 )12( cos* 2 )12( cos)()(),( 2 ),( 1 0 1 0 ππ
  • 29. Visualization of Basis FunctionsIncreasingfrequency Increasing frequency
  • 30. Quantization  Divide each coefficient by integer [1, 255] – comes in the form of a table, same size as a block – multiply the block of coefficients by the table, round result to nearest integer  In the decoding process, multiply the quantized coefficients by the inverse of the table – get back a number close to original – error is less than 1/2 of the quantization number  Larger quantization numbers cause more loss
  • 31. De facto Quantization Table 16 11 10 16 24 40 51 61 12 12 14 19 26 58 60 55 14 13 16 24 40 57 69 56 14 17 22 29 51 87 80 62 18 22 37 56 68 109 103 77 24 35 55 64 81 104 113 92 49 64 78 87 103 121 120 101 72 92 95 98 112 100 103 99 Eye becomes less sensitive Eyebecomeslesssensitive
  • 32. Entropy Encoding  Compress sequence of quantized DC and AC coefficients from quantization step – further increase compression, without loss  Separate DC from AC components – DC components change slowly, thus will be encoded using difference encoding
  • 33. DC Encoding  DC represents average intensity of a block – encode using difference encoding scheme – use 3x3 pattern of blocks  Because difference tends to be near zero, can use less bits in the encoding – categorize difference into difference classes – send the index of the difference class, followed by bits representing the difference
  • 34. AC Encoding  Use zig-zag ordering of coefficients – orders frequency components from low->high – produce maximal series of 0s at the end  Apply RLE to ordering
  • 35. Huffman Encoding  Sequence of DC difference indices and values along with RLE of AC coefficients  Apply Huffman encoding to sequence – Exploits sequence’s statistics by assigning frequently used symbols fewer bits than rare symbols  Attach appropriate headers  Finally have the JPEG image!
  • 36. JPEG Decoding Steps  Basically reverse steps performed in encoding process – Parse compressed image data and perform Huffman decoding to get RLE symbols – Undo RLE to get DCT coefficient matrix – Multiply by the quantization matrix – Take 2-D inverse DCT of this matrix to get reconstructed image data
  • 37. Reconstruction Error  Resulting image is “close” to original image  Usually measure “closeness” with MSE (Mean Squared Error) and PSNR (Peak Signal to Noise Ratio) – Want low MSE and high PSNR
  • 38. Example - One everyday photo with file size of 2.76 MB
  • 39. Example - One everyday photo with file size of 600 KB
  • 40. Example - One everyday photo with file size of 350 KB
  • 41. Example - One everyday photo with file size of 240 KB
  • 42. Example - One everyday photo with file size of 144 KB
  • 43. Example - One everyday photo with file size of 88 KB
  • 44. Analysis  Near perfect image at 2.76M, so-so image at 88K  Sharpness decreases as file size decreases  False contours visible at 144K and 88K – Can be fixed by dithering image before quantization  Which file size is the best? – No correct answer to this question – Answer depends upon how strict we are about image quality, what purpose image is to be used for, and the resources available