SlideShare a Scribd company logo
1 of 18
1
JPEG Compression
JPEG Compression
• JPEG compression is lossy, such that the original image cannot be
exactly reconstructed (although a "Lossless JPEG" specification exists
as well).
• JPEG exploits the characteristics of human vision, eliminating or
reducing data to which the eye is less sensitive. JPEG works well on
grayscale and color images, especially on photographs, but it is not
intended for two-tone images.
2
Basic Idea behind compression (JPEG)
• Our eyes is highly sensitive to intensity(grayscale) information and less
sensitive to color information.
• Again we are more sensitive to low frequency intensity value and less
sensitive to high frequency intensity value.
3
The key for any compression technique
• Compression at block level
• Using suitable transformation
• Smart quantization
• Entropy coding
4
The Key for JPEG Compression Technique
• Compression at block level : split image into non-overlapping blocks
where each block is 8X8 pixels in size.
• Using suitable transformation: compute DCT for each block
• Smart quantization: quantize DCT coefficients according to psych visually
tuned tables(pre defined quantization table)
• Entropy coding: finally the resulting bit stream is coded using run length
coding and Huffman coding
5
JPEG compression pipeline
6
Step 1: Color Conversion
• First the RGB image is converted to YCrCb (like in a television). Here Y is the
luminance or grayscale and CrCb is the chrominance or color (blue and red).
• The equations to do this: Y=0.299(R-G) + G + 0.114(B-G) Cb=0.564(B-Y) Cr=0.713(R-
Y)
• As human eyes are less sensitive to color information it is possible to reduce the
amount of information in CrCb channel without losing significant visual quality.
• In general, jpeg down sample by 2 in each direction. Means that the color information is
down sampled by 4 (4 times less color than the original one).
• Then this down sampled data is passed to next phase that is DCT.
7
Step 2: Preprocessing for DCT
• At step 2 which is preprocessing for DCT, first the image is separated into
non-overlapping blocks where each block is 8X8 pixels (64 pixels per
block).
• Then normalize the pixels value to -128 to 127 from 0 to 255, just by
subtracting 128 from each pixel value.
Fig. 1: Separating image into blocks Fig. 2: Normalization
8
Step 3: Discrete Cosine Transformation
• At step 3: each block is separately encoded with its own discrete cosine
transform. (actually jpeg uses DCT type II)
• So, after DCT we have exactly 64 cosine waves for each block, mean that
each pixels is replaced with a equivalent cosine wave.
• DCT is reversible means we can recover full data without loss.
• The DCT creates a new representation of image where it is easy to
separate important and less important pixels of the images.
[Details of DCT operation is given at the end of presentation]
9
Step 4: Quantization
• This is where the data is compressed in great extent. After performing DCT, we
apply quantization on it to remove the high frequency components. This is the real
data compression part of jpeg.
• For quantizing the DCT transformed data, jpeg use a predefined quantization table.
The amount of compression is dependent on the choice of quantization table.
• This quantization is non reversible meaning that we cant recover the original data
with out loss.
10
Step 5: Zig Zag Scanning
• Then, the quantized data is further processed using zig zag coding or scanning. This is
done to separate the DC and AC components. The first element in each 64x1 array
represents the DC coefficient from the DCT matrix, and the remaining 63 coefficients
represent the AC components.
• Then the DC components are coded using DPCM and Ac components using running
length coding.
Fig.1: Data after performing quantization Fig.2: Zig Zag scanning
11
Step 6: Coding of DC and AC coefficients
• DPCM Coding for DC components: DC components represent the intensity of
each 8x8 pixel block. The DC coefficient of any given input block is fairly
unpredictable by itself. However, significant correlation exists between the DC
components of adjacent blocks. That is, we can predict the DC coefficient value
of current block from the DC value of previous block. So, we can further
compress data.
• By using a differential prediction model (DPCM), we can increase the probability
that the value we encode will be small, and thus reduce the number of bits in the
compressed image. To obtain the coding value we simply subtract the DC
coefficient of the previously processed 8x8 pixel block from the DC coefficient of
the current block. This value is called the "DPCM difference
12
Step 6: Coding of DC and AC coefficients
• Run length coding of AC components: Because the values of the AC coefficients
tend towards zero after the quantization step, these coefficients are run-length
encoded. The concept of run-length encoding is a straightforward principle.
• The quantized output of the DCT blocks produces many zero-value bytes.
Instead of coding each zero individually, we simply encode the number of zeros in
a given 'run.' This run-length coded information is then variable-length coded
(VLC), usually using Huffman codes.
13
Step 7: Huffman Coding
• Finally, the final bit stream is coded using the Huffman coding which is the
desired output.
14
What does the DCT do?
• Let us work on an example, where we will use the following set
A = {1, 2, 3, 4, 5, 6, 7, 8}.
• The set has 8 elements, so n is 8. As you know, in computer science we love to
use the powers of two. Moreover, numbers in the set are correlated, an obvious
pattern, incremented by one. It is time to compute DCT coefficients.
• There are 8 numbers in the set A, so there will be 8 DCT coefficients in the
frequency domain. If you use the DCT formula above and compute the
coefficients for k =0, 1, 2, 3, 4, 5, 6, 7, you will see that the DCT coefficients are:
wA = {12.7279, -6.4423, 0, -0.6735, 0, -0.2009, 0, -0.0507}
15
• Let us talk about the values of the coefficients we computed. The DC coefficient,
w0, is 12.7279. The low-frequency coefficient, w1, is -6.4423. As you see the high-
frequency coefficients are small numbers. This is something we expected
because we have correlated numbers in the set A.
• If you compute DCT coefficients of a set elements where the numbers are not
correlated, we cannot say anything about the values of the coefficients. All may
be large numbers.
• Anyway, let’s go back to our example. We know that if the value of a coefficient is
small, it does not carry much information, so we can ignore the coefficients with
absolute values smaller than one.
• We now have wA = {12.7279, -6.4423, 0, 0, 0, 0, 0, 0}
What does the DCT do?
16
• If you compute DCT coefficients of a set elements where the numbers are
correlated, then the numbers are small.
• If you compute DCT coefficients of a set elements where the numbers are not
correlated, we cannot say anything about the values of the coefficients. All may
be large numbers.
• Again, small numbers(low intensity values) of image are represented by high-
frequency coefficients in DCT representation. And the large numbers(high
intensity values) are represented by low frequency coefficients in DCT
representation.
• So low frequency coefficients in DCT means high intensity value or correlated
data (or both). Which is not important.
What does the DCT do?
17
References:
1. http://www.eetimes.com/document.asp?doc_id=1225736
2. http://www.whydomath.org/node/wavlets/basicjpg.html
3. https://www.youtube.com/watch?v=Q2aEzeMDHMA&index=2&list=PL6rAVfCVE0e7yDuFhWXq
4_gf178iiwxZ9
4. https://www.youtube.com/watch?v=n_uNPbdenRs
18

More Related Content

What's hot

Introduction to Image Compression
Introduction to Image CompressionIntroduction to Image Compression
Introduction to Image CompressionKalyan Acharjya
 
Hough Transform By Md.Nazmul Islam
Hough Transform By Md.Nazmul IslamHough Transform By Md.Nazmul Islam
Hough Transform By Md.Nazmul IslamNazmul Islam
 
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 standardsRishab2612
 
Compression: Video Compression (MPEG and others)
Compression: Video Compression (MPEG and others)Compression: Video Compression (MPEG and others)
Compression: Video Compression (MPEG and others)danishrafiq
 
MPEG video compression standard
MPEG video compression standardMPEG video compression standard
MPEG video compression standardanuragjagetiya
 
image basics and image compression
image basics and image compressionimage basics and image compression
image basics and image compressionmurugan hari
 
Image restoration and degradation model
Image restoration and degradation modelImage restoration and degradation model
Image restoration and degradation modelAnupriyaDurai
 
Introduction To Video Compression
Introduction To Video CompressionIntroduction To Video Compression
Introduction To Video Compressionguestdd7ccca
 
Fundamentals of Data compression
Fundamentals of Data compressionFundamentals of Data compression
Fundamentals of Data compressionM.k. Praveen
 
Chapter 8 image compression
Chapter 8 image compressionChapter 8 image compression
Chapter 8 image compressionasodariyabhavesh
 

What's hot (20)

Introduction to Image Compression
Introduction to Image CompressionIntroduction to Image Compression
Introduction to Image Compression
 
Hough Transform By Md.Nazmul Islam
Hough Transform By Md.Nazmul IslamHough Transform By Md.Nazmul Islam
Hough Transform By Md.Nazmul Islam
 
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
 
Compression: Video Compression (MPEG and others)
Compression: Video Compression (MPEG and others)Compression: Video Compression (MPEG and others)
Compression: Video Compression (MPEG and others)
 
JPEG Image Compression
JPEG Image CompressionJPEG Image Compression
JPEG Image Compression
 
Data compression
Data compressionData compression
Data compression
 
Mpeg 2
Mpeg 2Mpeg 2
Mpeg 2
 
MPEG video compression standard
MPEG video compression standardMPEG video compression standard
MPEG video compression standard
 
image compression ppt
image compression pptimage compression ppt
image compression ppt
 
Jpeg dct
Jpeg dctJpeg dct
Jpeg dct
 
image basics and image compression
image basics and image compressionimage basics and image compression
image basics and image compression
 
Digital Image Fundamentals - II
Digital Image Fundamentals - IIDigital Image Fundamentals - II
Digital Image Fundamentals - II
 
Image restoration and degradation model
Image restoration and degradation modelImage restoration and degradation model
Image restoration and degradation model
 
Introduction To Video Compression
Introduction To Video CompressionIntroduction To Video Compression
Introduction To Video Compression
 
Run length encoding
Run length encodingRun length encoding
Run length encoding
 
Segmentation
SegmentationSegmentation
Segmentation
 
Fundamentals of Data compression
Fundamentals of Data compressionFundamentals of Data compression
Fundamentals of Data compression
 
Image compression
Image compressionImage compression
Image compression
 
Data compression
Data compressionData compression
Data compression
 
Chapter 8 image compression
Chapter 8 image compressionChapter 8 image compression
Chapter 8 image compression
 

Similar to Jpeg compression

Compression using JPEG
Compression using JPEGCompression using JPEG
Compression using JPEGSabih Hasan
 
image compression in data compression
image compression in data compressionimage compression in data compression
image compression in data compressionZaabir Ali
 
image processing for jpeg presentati.ppt
image processing for jpeg presentati.pptimage processing for jpeg presentati.ppt
image processing for jpeg presentati.pptnaghamallella
 
Multimedia communication jpeg
Multimedia communication jpegMultimedia communication jpeg
Multimedia communication jpegDr. Kapil Gupta
 
Multimedia image compression standards
Multimedia image compression standardsMultimedia image compression standards
Multimedia image compression standardsMazin Alwaaly
 
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
 
lossy compression JPEG
lossy compression JPEGlossy compression JPEG
lossy compression JPEGMahmoud Hikmet
 
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
 
MPEG-1 Part 2 Video Encoding
MPEG-1 Part 2 Video EncodingMPEG-1 Part 2 Video Encoding
MPEG-1 Part 2 Video EncodingChristian Kehl
 
Digital Image Processing - Image Compression
Digital Image Processing - Image CompressionDigital Image Processing - Image Compression
Digital Image Processing - Image CompressionMathankumar S
 
project ppt on anti counterfeiting technique for credit card transaction system
project ppt on anti counterfeiting technique for credit card transaction systemproject ppt on anti counterfeiting technique for credit card transaction system
project ppt on anti counterfeiting technique for credit card transaction systemRekha dudiya
 
Video Compression Basics
Video Compression BasicsVideo Compression Basics
Video Compression BasicsSanjiv Malik
 
CyberSec_JPEGcompressionForensics.pdf
CyberSec_JPEGcompressionForensics.pdfCyberSec_JPEGcompressionForensics.pdf
CyberSec_JPEGcompressionForensics.pdfMohammadAzreeYahaya
 

Similar to Jpeg compression (20)

Jpeg standards
Jpeg   standardsJpeg   standards
Jpeg standards
 
Compression using JPEG
Compression using JPEGCompression using JPEG
Compression using JPEG
 
image compression in data compression
image compression in data compressionimage compression in data compression
image compression in data compression
 
image processing for jpeg presentati.ppt
image processing for jpeg presentati.pptimage processing for jpeg presentati.ppt
image processing for jpeg presentati.ppt
 
Data compression
Data compressionData compression
Data compression
 
Image compression Algorithms
Image compression AlgorithmsImage compression Algorithms
Image compression Algorithms
 
Multimedia communication jpeg
Multimedia communication jpegMultimedia communication jpeg
Multimedia communication jpeg
 
Multimedia image compression standards
Multimedia image compression standardsMultimedia image compression standards
Multimedia image compression standards
 
Jpeg
JpegJpeg
Jpeg
 
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...
 
lossy compression JPEG
lossy compression JPEGlossy compression JPEG
lossy compression JPEG
 
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...
 
MPEG-1 Part 2 Video Encoding
MPEG-1 Part 2 Video EncodingMPEG-1 Part 2 Video Encoding
MPEG-1 Part 2 Video Encoding
 
Digital Image Processing - Image Compression
Digital Image Processing - Image CompressionDigital Image Processing - Image Compression
Digital Image Processing - Image Compression
 
RNN-LSTM.pptx
RNN-LSTM.pptxRNN-LSTM.pptx
RNN-LSTM.pptx
 
project ppt on anti counterfeiting technique for credit card transaction system
project ppt on anti counterfeiting technique for credit card transaction systemproject ppt on anti counterfeiting technique for credit card transaction system
project ppt on anti counterfeiting technique for credit card transaction system
 
Video Compression Basics
Video Compression BasicsVideo Compression Basics
Video Compression Basics
 
Steganography Part 2
Steganography Part 2Steganography Part 2
Steganography Part 2
 
Ch7 031102
Ch7 031102Ch7 031102
Ch7 031102
 
CyberSec_JPEGcompressionForensics.pdf
CyberSec_JPEGcompressionForensics.pdfCyberSec_JPEGcompressionForensics.pdf
CyberSec_JPEGcompressionForensics.pdf
 

More from Hossain Md Shakhawat

More from Hossain Md Shakhawat (20)

Recipe for the effective presentaion
Recipe for the effective presentaionRecipe for the effective presentaion
Recipe for the effective presentaion
 
The Road to Higher study in Japan
The Road to Higher study in JapanThe Road to Higher study in Japan
The Road to Higher study in Japan
 
Application of dfs
Application of dfsApplication of dfs
Application of dfs
 
Breadth first search and depth first search
Breadth first search and  depth first searchBreadth first search and  depth first search
Breadth first search and depth first search
 
Islamic jurisprudence
Islamic jurisprudenceIslamic jurisprudence
Islamic jurisprudence
 
Introduction to Medical Imaging
Introduction to Medical ImagingIntroduction to Medical Imaging
Introduction to Medical Imaging
 
Surah Fatiha
Surah FatihaSurah Fatiha
Surah Fatiha
 
Hashing
HashingHashing
Hashing
 
Decision making and looping
Decision making and loopingDecision making and looping
Decision making and looping
 
Decision making and branching
Decision making and branchingDecision making and branching
Decision making and branching
 
Digital signature
Digital signatureDigital signature
Digital signature
 
Caesar cipher
Caesar cipherCaesar cipher
Caesar cipher
 
Rsa rivest shamir adleman
Rsa rivest shamir adlemanRsa rivest shamir adleman
Rsa rivest shamir adleman
 
Fundamentals of cryptography
Fundamentals of cryptographyFundamentals of cryptography
Fundamentals of cryptography
 
Introduction to programming with c,
Introduction to programming with c,Introduction to programming with c,
Introduction to programming with c,
 
Introduction to digital image processing
Introduction to digital image processingIntroduction to digital image processing
Introduction to digital image processing
 
History of computing
History of computingHistory of computing
History of computing
 
Introduction to Printers
Introduction to PrintersIntroduction to Printers
Introduction to Printers
 
Input devices_(Mouse and Keyboard)
Input devices_(Mouse and Keyboard)Input devices_(Mouse and Keyboard)
Input devices_(Mouse and Keyboard)
 
Binary search tree(bst)
Binary search tree(bst)Binary search tree(bst)
Binary search tree(bst)
 

Recently uploaded

Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 

Recently uploaded (20)

Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 

Jpeg compression

  • 2. JPEG Compression • JPEG compression is lossy, such that the original image cannot be exactly reconstructed (although a "Lossless JPEG" specification exists as well). • JPEG exploits the characteristics of human vision, eliminating or reducing data to which the eye is less sensitive. JPEG works well on grayscale and color images, especially on photographs, but it is not intended for two-tone images. 2
  • 3. Basic Idea behind compression (JPEG) • Our eyes is highly sensitive to intensity(grayscale) information and less sensitive to color information. • Again we are more sensitive to low frequency intensity value and less sensitive to high frequency intensity value. 3
  • 4. The key for any compression technique • Compression at block level • Using suitable transformation • Smart quantization • Entropy coding 4
  • 5. The Key for JPEG Compression Technique • Compression at block level : split image into non-overlapping blocks where each block is 8X8 pixels in size. • Using suitable transformation: compute DCT for each block • Smart quantization: quantize DCT coefficients according to psych visually tuned tables(pre defined quantization table) • Entropy coding: finally the resulting bit stream is coded using run length coding and Huffman coding 5
  • 7. Step 1: Color Conversion • First the RGB image is converted to YCrCb (like in a television). Here Y is the luminance or grayscale and CrCb is the chrominance or color (blue and red). • The equations to do this: Y=0.299(R-G) + G + 0.114(B-G) Cb=0.564(B-Y) Cr=0.713(R- Y) • As human eyes are less sensitive to color information it is possible to reduce the amount of information in CrCb channel without losing significant visual quality. • In general, jpeg down sample by 2 in each direction. Means that the color information is down sampled by 4 (4 times less color than the original one). • Then this down sampled data is passed to next phase that is DCT. 7
  • 8. Step 2: Preprocessing for DCT • At step 2 which is preprocessing for DCT, first the image is separated into non-overlapping blocks where each block is 8X8 pixels (64 pixels per block). • Then normalize the pixels value to -128 to 127 from 0 to 255, just by subtracting 128 from each pixel value. Fig. 1: Separating image into blocks Fig. 2: Normalization 8
  • 9. Step 3: Discrete Cosine Transformation • At step 3: each block is separately encoded with its own discrete cosine transform. (actually jpeg uses DCT type II) • So, after DCT we have exactly 64 cosine waves for each block, mean that each pixels is replaced with a equivalent cosine wave. • DCT is reversible means we can recover full data without loss. • The DCT creates a new representation of image where it is easy to separate important and less important pixels of the images. [Details of DCT operation is given at the end of presentation] 9
  • 10. Step 4: Quantization • This is where the data is compressed in great extent. After performing DCT, we apply quantization on it to remove the high frequency components. This is the real data compression part of jpeg. • For quantizing the DCT transformed data, jpeg use a predefined quantization table. The amount of compression is dependent on the choice of quantization table. • This quantization is non reversible meaning that we cant recover the original data with out loss. 10
  • 11. Step 5: Zig Zag Scanning • Then, the quantized data is further processed using zig zag coding or scanning. This is done to separate the DC and AC components. The first element in each 64x1 array represents the DC coefficient from the DCT matrix, and the remaining 63 coefficients represent the AC components. • Then the DC components are coded using DPCM and Ac components using running length coding. Fig.1: Data after performing quantization Fig.2: Zig Zag scanning 11
  • 12. Step 6: Coding of DC and AC coefficients • DPCM Coding for DC components: DC components represent the intensity of each 8x8 pixel block. The DC coefficient of any given input block is fairly unpredictable by itself. However, significant correlation exists between the DC components of adjacent blocks. That is, we can predict the DC coefficient value of current block from the DC value of previous block. So, we can further compress data. • By using a differential prediction model (DPCM), we can increase the probability that the value we encode will be small, and thus reduce the number of bits in the compressed image. To obtain the coding value we simply subtract the DC coefficient of the previously processed 8x8 pixel block from the DC coefficient of the current block. This value is called the "DPCM difference 12
  • 13. Step 6: Coding of DC and AC coefficients • Run length coding of AC components: Because the values of the AC coefficients tend towards zero after the quantization step, these coefficients are run-length encoded. The concept of run-length encoding is a straightforward principle. • The quantized output of the DCT blocks produces many zero-value bytes. Instead of coding each zero individually, we simply encode the number of zeros in a given 'run.' This run-length coded information is then variable-length coded (VLC), usually using Huffman codes. 13
  • 14. Step 7: Huffman Coding • Finally, the final bit stream is coded using the Huffman coding which is the desired output. 14
  • 15. What does the DCT do? • Let us work on an example, where we will use the following set A = {1, 2, 3, 4, 5, 6, 7, 8}. • The set has 8 elements, so n is 8. As you know, in computer science we love to use the powers of two. Moreover, numbers in the set are correlated, an obvious pattern, incremented by one. It is time to compute DCT coefficients. • There are 8 numbers in the set A, so there will be 8 DCT coefficients in the frequency domain. If you use the DCT formula above and compute the coefficients for k =0, 1, 2, 3, 4, 5, 6, 7, you will see that the DCT coefficients are: wA = {12.7279, -6.4423, 0, -0.6735, 0, -0.2009, 0, -0.0507} 15
  • 16. • Let us talk about the values of the coefficients we computed. The DC coefficient, w0, is 12.7279. The low-frequency coefficient, w1, is -6.4423. As you see the high- frequency coefficients are small numbers. This is something we expected because we have correlated numbers in the set A. • If you compute DCT coefficients of a set elements where the numbers are not correlated, we cannot say anything about the values of the coefficients. All may be large numbers. • Anyway, let’s go back to our example. We know that if the value of a coefficient is small, it does not carry much information, so we can ignore the coefficients with absolute values smaller than one. • We now have wA = {12.7279, -6.4423, 0, 0, 0, 0, 0, 0} What does the DCT do? 16
  • 17. • If you compute DCT coefficients of a set elements where the numbers are correlated, then the numbers are small. • If you compute DCT coefficients of a set elements where the numbers are not correlated, we cannot say anything about the values of the coefficients. All may be large numbers. • Again, small numbers(low intensity values) of image are represented by high- frequency coefficients in DCT representation. And the large numbers(high intensity values) are represented by low frequency coefficients in DCT representation. • So low frequency coefficients in DCT means high intensity value or correlated data (or both). Which is not important. What does the DCT do? 17
  • 18. References: 1. http://www.eetimes.com/document.asp?doc_id=1225736 2. http://www.whydomath.org/node/wavlets/basicjpg.html 3. https://www.youtube.com/watch?v=Q2aEzeMDHMA&index=2&list=PL6rAVfCVE0e7yDuFhWXq 4_gf178iiwxZ9 4. https://www.youtube.com/watch?v=n_uNPbdenRs 18