mmn lec4-image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/class...
TRANSCRIPT
![Page 1: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/1.jpg)
Image (Fundamentals, Compression Techniques & Standards)
Hamid R. RabieeMostafa Salehi, Fatemeh Dabiran, Hoda Ayatollahi
Spring 2011
![Page 2: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/2.jpg)
Digital Media Lab - Sharif University of Technology2
Outlines
²Image Fundamentals² Sampling, Quantization
²Image Compression Techniques
²Image Coding Standards² JPEG² JPEG2000
![Page 3: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/3.jpg)
Fundamentals of an Image
² An image consists of pixels (picture elements)
² Each pixel has typically 8-bits and represents luminance (and
color)
² Image Representation² Color spaces
²RGB (red-green-blue)
²CMY (cyan-magenta-yellow)
²YUV
² Greyscale (e.g. 8-bit per pixel)
² Binary (1-bit per pixel)3 Digital Media Lab - Sharif University of Technology
![Page 4: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/4.jpg)
Fundamentals of an Image
² A TV frame is about 640x480 pixels; each pixel has 8-bits =>
Total image size: 640×480*3=921,600 bytes or ≈7.4Mbits
At 30 frames per second, this would be ≈ 220Mbits/second
Do we need all these bits? No!
4 Digital Media Lab - Sharif University of Technology
![Page 5: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/5.jpg)
Fundamentals of an Image
² An example of eye’s sensitivity to luminance:
²We can build a perceptual model² Only code what is important to the Human Visual System (HVS)
²Usually a function of spatial frequency
5
An image with 8-bits/pixel An image with 6-bits/pixel An image with 4-bits/pixel
Digital Media Lab - Sharif University of Technology
![Page 6: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/6.jpg)
Sampling and Quantization
² Computer handles “discrete” data.² Sampling² Sample the value of the image at the nodes of a
regular grid on the image plane.
² A pixel (picture element) at (i, j) is the image intensity value at grid point indexed by the integer coordinate (i, j).
² Quantization² Is a process of transforming a real valued sampled
image to one taking only a finite number of distinct values.
² Each sampled value in a 256-level grayscale image is represented by 8 bits.
6
020
4060
80
0
50
1000
50
100
150
200
250
columnsrows
inte
nsity
y x
I(x,y)
y
x
Digital Media Lab - Sharif University of Technology
![Page 7: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/7.jpg)
Examples of Sampling
256x256
64x64
16x16
7 Digital Media Lab - Sharif University of Technology
![Page 8: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/8.jpg)
Examples of Quantizaion
8 bits / pixel
4 bits / pixel
2 bits / pixel
8 Digital Media Lab - Sharif University of Technology
![Page 9: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/9.jpg)
IMAGE COMPRESSION PRINCIPLES
Winter 2011
9 Digital Media Lab - Sharif University of Technology
![Page 10: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/10.jpg)
Image Compression
What is image compression?
² Image compression is the art/science of finding efficient
representations for digital images in order to:
² Reduce the memory required for their storage,
² Reduce required bandwidth or time for their transfer across
communication channels
² Increase the effective data transfer rate when reading from storage
devices
Digital Media Lab - Sharif University of Technology10
![Page 11: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/11.jpg)
Image Compression
Types of Image Compression² Lossless (Reversible, Bit-preserving)
²The image after compression/ decompression is numerically
identical to the original image on a pixel-by-pixel basis.
²Only the statistical redundancy is exploited to achieve compression
² Lossy (Irreversible)
²The reconstructed image contains degradations relative to the
original image
²The statistical redundancy as well as the perceptual irrelevancy of
the image data are exploited
11 Digital Media Lab - Sharif University of Technology
![Page 12: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/12.jpg)
Requirements for Compression Algorithms
² Objectives
² Minimize the complexity of the encoding and decoding process
² Ensure a good quality of decoded images
² Achieve high compression ratios
² Other general requirements
² Independence of specific size and frame rate
² Support various data rates
Digital Media Lab - Sharif University of Technology12
![Page 13: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/13.jpg)
Some Coding Techniques
² Only for review² Run-Length Encoding
² Huffman Coding
² Arithmetic Coding
13 Digital Media Lab - Sharif University of Technology
![Page 14: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/14.jpg)
Huffman Coding
² Huffman coding uses longer code-words for symbols with
smaller probabilities and shorter code-words for symbols
that often occur.
² Example:
s1
s2
s3
s4
0.125
0.125
0.25
0.5
0.25
0.51
0
0
1
0
1
(01)
(1)
(001)
(000)
14 Digital Media Lab - Sharif University of Technology
![Page 15: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/15.jpg)
Run-Length Encoding
² a data compression algorithm that is supported by most bitmap file formats,
such as TIFF, BMP
² RLE works by reducing the physical size of a repeating string of characters.
² This repeating string, called a run, is typically encoded into two bytes.
² The first byte represents the number of characters in the run and is called the run
count
² The second byte is the value of the character in the run, which is in the range of 0 to
255, and is called the run value.
² There are various and different ways in RLE!
² We explain the algorithm that is used in JPEG in future slides
15 Digital Media Lab - Sharif University of Technology
AAAAAAbbbXXXXXt → 6A3b5X1t
![Page 16: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/16.jpg)
Variants on Run-Length Encoding
² There are a number of variants of run-length encoding
²We will discuss about one of them which is used in JPEG
Coding!² It is a bit different from previous slide definition
Digital Media Lab - Sharif University of Technology16
![Page 17: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/17.jpg)
Arithmetic Coding
² Arithmetic coding represents a input symbol string as a
small interval in [0, 1)
² The size of the interval equals
P(sk1) P(sk2) P(sk3) … P(skn)
²We can then represent the interval with a binary code.
17 Digital Media Lab - Sharif University of Technology
![Page 18: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/18.jpg)
Arithmetic Coding; an example
² A source output symbols {A, B, C, D, E, F, $}. $ is the termination
symbol.
² Their probabilities are as follows:
P(A) = 0.2P(B) = 0.1P(C) = 0.2P(D) = 0.05P(E) = 0.3P(F) = 0.05P($) = 0.1
1
0
0.20.3
0.50.55
0.850.9
18Digital Media Lab - Sharif University of Technology
![Page 19: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/19.jpg)
IMAGE CODING STANDARDSWinter 2011
19 Digital Media Lab - Sharif University of Technology
![Page 20: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/20.jpg)
Image Compression Standards
² GIF (Graphics Interchange Format)
² PNG (Portable Network Graphics)
² JPEG (Join Picture Expert Group)
Digital Media Lab - Sharif University of Technology20
![Page 21: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/21.jpg)
GIF
² GIF (Graphics Interchange Format)² Indexed image format: up to 256 colors per image, chosen from a variable palette
² One color index can indicate transparency.
² Uses lossless LZW compression of data bytes.
² Optional interlacing capability.
² GIF became very popular in the early days of the Web.
² Supported by NCSA Mosaic.
² Pretty good compression.
² Most displays then were indexed rather than true color.
² Today it’s still good for diagrams, cartoons, and other non-photographic images.
² Lossless encoding good for sharp edges (doesn’t blur)
²
21 Digital Media Lab - Sharif University of Technology
![Page 22: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/22.jpg)
PNG
² PNG (Portable Network Graphics)
² Supports true color, grayscale, and palette-based (8 bit) color maps
² Uses DEFLATE algorithm
² As used in gzip
² LZ77 algorithm with Huffman coding (You know it!)
² Patent free.
Digital Media Lab - Sharif University of Technology22
![Page 23: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/23.jpg)
JPEG
² JPEG: Joint Photographic Expert Group — an international standard
in 1992.
² Works for both color and grayscale images.
² Applications include satellite, medical imaging, general photography ...
² Good for compressing photographic images
² Gradual changes in color
² Not good for graphics
² Sharp changes in color
² Compression ratio of 10:1 achievable without visible loss
Digital Media Lab - Sharif University of Technology23
![Page 24: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/24.jpg)
JPEG Modes
² Lossless JPEG² Coding: Predictive, sequential.
² Resolution: From 2 bits/pixels to 16 bits/pixels
² Huffman coding or Arithmetic coding; Four DC tables
² Interleaved and non-Interleaved scans
² Sequential (Baseline) JPEG² Coding: DCT-based, sequential.
² Resolution: 8 bits/pixels
² Huffman coding; Two AC and two DC tables
² Interleaved and non-Interleaved scans
Digital Media Lab - Sharif University of Technology24
![Page 25: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/25.jpg)
JPEG Modes (cont.)
² Progressive JPEG² Coding: DCT-based, progressive.
² Resolution: 8 or 12 bits/pixels
² Huffman coding or Arithmetic coding; Four DC tables
² Interleaved and non-Interleaved scans
² Hierarchical JPEG² Coding: DCT-based or lossless process.
² Multiple frames (non-differential and differential)
² Interleaved and non-Interleaved scans
Digital Media Lab - Sharif University of Technology25
![Page 26: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/26.jpg)
Sequential vs. Progressive
Digital Media Lab - Sharif University of Technology26
![Page 27: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/27.jpg)
The System of JPEG Encoder
8x8 block DCT Quantization
Quantizationtables
DPCM
Run length coding (RLC)
Entropycoding
HeaderTables
Data
DC
AC
27 Digital Media Lab - Sharif University of Technology
YUV
![Page 28: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/28.jpg)
JPEG Blocks in brief
² Color Space Conversion (Not a block indeed) : Convert RGB (24 bit)
data to YUV
² Blocking: Divide each image up into 8x8 tiles
² Transformation: Convert to frequency space using a two-dimensional
DCT
² Quantization (Only in lossy mode): Quantize the frequency space, using
more bits for the lower frequencies
² Coding: Encode the quantized values using Run-length encoding and
Huffman coding in a zig-zag manner.
28 Digital Media Lab - Sharif University of Technology
![Page 29: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/29.jpg)
Color Space Conversion
² JPEG first converts RGB to YUV or YCrCb.
² Advantages:² Reduce correlation between components² Improve coding efficiency² Allow visually relevant quantization
² Two Transforms:² Irreversible colour transform (ICT) ² Reversible colour transform (RCT)
29 Digital Media Lab - Sharif University of Technology
DCT QuantizationDPCM
RLC
Entropy Coding
BlockingRGB to YUV
![Page 30: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/30.jpg)
Color Space Conversion
² JPEG first converts RGB to YUV or YCrCb.
² Advantages:² Reduce correlation between components² Improve coding efficiency² Allow visually relevant quantization
² Two Transforms:² Irreversible colour transform (ICT) ² Reversible colour transform (RCT)
30 Digital Media Lab - Sharif University of Technology
DCT QuantizationDPCM
RLC
Entropy Coding
BlockingRGB to YUV
![Page 31: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/31.jpg)
Blocking
² The original image is first divided into a number of smallersub images or blocks which usually are processedindependently of one another.
²Why do we use blocking?² Correlation
² Using Stationary features of Signal
² Simple Implementation (Why?)
31 Digital Media Lab - Sharif University of Technology
DCT QuantizationDPCM
RLC
Entropy Coding
BlockingRGB to YUV
![Page 32: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/32.jpg)
Original 8 × 8 Image Block
² The following example represents an 8 × 8 block (Y)of the original image
LENNA.
Digital Media Lab - Sharif University of Technology32
![Page 33: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/33.jpg)
DCT (Discrete Cosine Transform)
² DCT converts each image 8x8 block into another 8x8 block
² Mean Subtracted Image Block: The value of 128
is subtracted from each pixel prior to the application
of the discrete cosine transform (DCT). This places the
DC coefficient (the top-left corner coefficient that is
proportional to the average brightness of the block) in
the range (–1024, +1016).
Digital Media Lab - Sharif University of Technology33
DCT QuantizationDPCM
RLC
Entropy Coding
BlockingRGB to YUV
![Page 34: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/34.jpg)
DCT of 8 × 8 Image Block
² The JPEG forward DCT is defined as
Digital Media Lab - Sharif University of Technology34
![Page 35: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/35.jpg)
DCT (Spatial Frequency) (cont.)
u
v
35 Digital Media Lab - Sharif University of Technology
![Page 36: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/36.jpg)
Quantization
² Recall that quantization can be used to collapse the input into
smaller number of values.
² For DCT coefficients, we want to quantize different
coefficients in different details:² DC coefficient should have the most quantization levels.
² Quantization for AC coefficients can be coarser and coarser as the
frequency increases.
36 Digital Media Lab - Sharif University of Technology
DCT QuantizationDPCM
RLC
Entropy Coding
BlockingRGB to YUV
![Page 37: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/37.jpg)
Quantization Matrices
Y quantization table
17 18 24 99 99 99 99 9918 21 26 66 99 99 99 9924 26 56 99 99 99 99 9947 66 99 99 99 99 99 9999 99 99 99 99 99 99 9999 99 99 99 99 99 99 9999 99 99 99 99 99 99 99
U, V quantization table
Fq(u,v) = round(F(u,v)/Q(u,v))Quantization:
Fr(u,v) = Fq(u,v) * Q(u,v)De-quantization:
Bet
ter q
uant
izat
ion
at lo
w fr
eque
ncie
s
Coa
rse
quan
tizat
ion
at
high
freq
uenc
ies
37 Digital Media Lab - Sharif University of Technology
![Page 38: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/38.jpg)
² Quantization step size = 20
² DCT unquantized coefficient = 13.56
² Scaled coefficient =13.56/20 = 0.68
² Scaled, quantized (rounded) coefficient = 1
² Dequantized coefficient (Decoder) = 1 × 20 = 20
Quantization ExampleQuantization Example
38 Digital Media Lab - Sharif University of Technology
![Page 39: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/39.jpg)
² After normalization, the coefficients are quantized by rounding off to
the nearest integer.
² The normalization/quantization process typically results in many zero-
valued coefficients which can be coded efficiently.
Normalized/Quantized CoefficientsNormalized/Quantized Coefficients
39 Digital Media Lab - Sharif University of Technology
![Page 40: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/40.jpg)
Quantization (Dequantization) Example
Quantization
Dequantization
40Digital Media Lab - Sharif University of Technology
DCT
![Page 41: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/41.jpg)
DC & AC Coefficients
² The top-left coefficient in the 2-D DCT array is referred to as the DC coefficient and is proportional to the average brightness of the spatial block.
² DC coefficient is treated separately from the 63 AC coefficients:² DPCM for DC coefficient encoding² Run-Length Coding for AC coefficients encoding
41 Digital Media Lab - Sharif University of Technology
![Page 42: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/42.jpg)
DC Coefficients Encoding
² Differential Pulse Code Modulation (DPCM): Take difference with the
DC coefficient of the previous block.
Digital Media Lab - Sharif University of Technology42
DCT QuantizationDPCM
RLC
Entropy Coding
BlockingRGB to YUV
(These variable length codes are standardized for jpeg)
![Page 43: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/43.jpg)
DC Coefficients Encoding (cont.)
² This difference is first assigned to one of the 12 categories values where
the values in category k are in the range and
² A set of Huffman codes with a maximum codeword length of 16 bits is
used to specify the different categories.
43
)12,2( 1 −± − kk 110 ≤≤ k
Digital Media Lab - Sharif University of Technology
The Size Table
7 will be coded as (3, 7)• The first number 3 is Huffman
coded.• The second 7 is encoded as 1’s complement 111.(-7 will be 000)
00-1, 11
-3, -2, 2, 32-7 …-4, 4, …,73
…-2047,…,-
1024,1024,…,204711
![Page 44: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/44.jpg)
AC Coefficients Encoding
² AC coefficients are not differentially encoded, Instead, we first do run-
length coding.
² Order the coefficients in zig-zag order, then, run length coding
44
DCT QuantizationDPCM
RLC
Entropy Coding
BlockingRGB to YUV
Digital Media Lab - Sharif University of Technology
Zig-
zag
scan
ning
Quantized DCT AC coefficients in zigzag order:
![Page 45: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/45.jpg)
Entropy CodingEntropy Coding
² Entropy coding of the baseline encoder is accomplished in two stages.
² The first stage is the translation of the quantized DCT coefficients into an
intermediate set of symbols.
² In the second stage, variable length codes are assigned to each symbol.
² For the JPEG standard a symbol is structured in two parts:
² a variable length code (VLC) for the first part, normally referred to as
symbol-1
² followed by a binary representation of the amplitude for the second part,
symbol-2
45
DCT QuantizationDPCM
RLC
Entropy Coding
BlockingRGB to YUV
Digital Media Lab - Sharif University of Technology
![Page 46: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/46.jpg)
Symbol-1
² For each nonzero AC coefficient in zigzag scan order, symbol-1 is described as
a two-dimensional event of (RUN, CAT), sometimes called (RUN, SIZE).
² For the baseline encoder, CAT is the category for the amplitude of a
nonzero coefficient in the zigzag order (it is identical to AC coefficients
table)
² RUN is the number of zeros preceding this nonzero coefficient
Digital Media Lab - Sharif University of Technology46
18: (Run,CAT)=(0,5)Code word from standard table=11010-21:(Run,CAT)=(0,5)Code word from standard table=11010
![Page 47: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/47.jpg)
Symbol-2
² The symbol-2 is the lower order bits of the value of coefficient
Digital Media Lab - Sharif University of Technology47
18=000010010-21=111…1101010
Final Code: symbol-1 code+ symbol-2 code18=1101010010-21=1101001010
![Page 48: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/48.jpg)
JPEG DecodingJPEG Decoding
² Decoding is simply the reverse of encoding.² Reverse the Huffman, RLE encodings.² Dequantization² Apply inverse DCT (IDCT):
48 Digital Media Lab - Sharif University of Technology
![Page 49: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/49.jpg)
JPEG Compression ratio
² Compression ratio depends on how large the values in the quantization
matrix are.
² 10:1 achievable without noticeable loss.
² 100:1 achievable, but artifacts are noticeable.
Digital Media Lab - Sharif University of Technology49
![Page 50: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/50.jpg)
JPEG File FormatJPEG File Format
Start of image Frame End of image
Tables Header Scan Scan Scan…
Tables Header Segment Restart Segment ….
Block Block Block
50 Digital Media Lab - Sharif University of Technology
![Page 51: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/51.jpg)
The JPEG Extended SystemThe JPEG Extended System--JPEGJPEG20002000
² The basic mode of JPEG supports sequential coding (the
order is from top to bottom and left to right).
² The JPEG extended system enhances the baseline system
to satisfy a broader range of applications.
51 Digital Media Lab - Sharif University of Technology
![Page 52: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/52.jpg)
The JPEG Extended System FeaturesThe JPEG Extended System Features
² 12-bit/pixel input image precision
² Sequential progressive build-up
² Hierarchical progressive build-up
² Arithmetic coding
² Adaptive quantization
52 Digital Media Lab - Sharif University of Technology
![Page 53: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/53.jpg)
Why another standard?Why another standard?
53 Digital Media Lab - Sharif University of Technology
² Low Bit-Rate Compression: At low bit-rates (e.g. below 0.25
bpp for highly detailed gray-level images) the distortion in
JPEG becomes unacceptable.
² Lossless and Lossy Compression: Need for standard, which
provide lossless and lossy compression in one code-stream.
² Large Images: JPEG doesn't compress images greater then
64x64K without tiling.
![Page 54: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/54.jpg)
JPEG JPEG 2000 2000 FeaturesFeatures
² Can be both lossless and lossy
² Improves image quality
² Uses Wavelete Coding instead of DCT; a layered file structure
² Progressive transmission
² Progressive rendering
² File structure flexibility
² Could use for a variety of applications
² Many functionalities; e.g. Region-Of-Interest
54Digital Media Lab - Sharif University of Technology
![Page 55: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/55.jpg)
Wavelet CodingWavelet Coding
² The wavelet transform uses basis functions that are scaled
and translated versions of a single prototype function (the
basic or mother wavelet).
² The wavelet transform can be viewed as a bank of
bandpass filters, where the filters have increasing
bandwidth as the center frequency increases
55 Digital Media Lab - Sharif University of Technology
![Page 56: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/56.jpg)
Wavelet Coding (cont.) Wavelet Coding (cont.)
² Details
56 Digital Media Lab - Sharif University of Technology
![Page 57: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/57.jpg)
Wavelet Coding (cont.) Wavelet Coding (cont.)
Digital Media Lab - Sharif University of Technology57
(1) Stage1 of DWT (2) Stage2 of DWT (3) Stage3 of DWT
Discrete Wavelet Transform on Baboon image
² In JPEG2000 multiple stages of the DWT are performed.
² JPEG2000 supports from 0 to 32 stages. For natural images,
usually between 4 to 8 stages are used.
![Page 58: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/58.jpg)
58
RegionRegion--ofof--interest (ROI)interest (ROI)
² A ROI is a part of an image that is encoded with higher quality than the
rest of the image (the background). The encoding is done in such a way
that the information associated with ROI precedes the information
associated with the background.
58 Digital Media Lab - Sharif University of Technology
![Page 59: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/59.jpg)
ROI Example
² Region of interest with better quality
Digital Media Lab - Sharif University of Technology59
![Page 60: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/60.jpg)
JPEGJPEG2000 2000 at at 00..125 125 bppbpp
C. Christopoulos, A. Skodras, T. Ebrahimi, JPEG2000 (online tutorial)60 Digital Media Lab - Sharif University of Technology
![Page 61: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/61.jpg)
JPEG at JPEG at 00..125 125 bppbpp (enlarged)(enlarged)
C. Christopoulos, A. Skodras, T. Ebrahimi, JPEG2000 (online tutorial)61 Digital Media Lab - Sharif University of Technology
![Page 62: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/62.jpg)
References
² Mohammed Ghanbari , “Standard Codecs: Image Compression to
Advanced Video Coding”, Institution of Electrical Engineers, 2003.
Digital Media Lab - Sharif University of Technology62
![Page 63: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/63.jpg)
Digital Media Lab - Sharif University of Technology
Next Session
Video
63
![Page 64: MMN lec4-Image v2.ppt - ce.sharif.educe.sharif.edu/courses/89-90/2/ce873-1/resources/root/Class Notes... · Fundamentals of an Image †An image consists of pixels (picture elements)](https://reader030.vdocuments.us/reader030/viewer/2022021808/5bfa3f4009d3f254508be1a2/html5/thumbnails/64.jpg)
64
Any Question
Thank you!
Digital Media Lab - Sharif University of Technology