0% found this document useful (0 votes)
6 views81 pages

Digital 3

Uploaded by

Mohamed Tarkas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views81 pages

Digital 3

Uploaded by

Mohamed Tarkas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 81

Image compression Techniques

What Is Image Compression?


• Reducing the number of bits needed to
represent an image.
• Ideally, an image compression technique
removes redundant information, and
efficiently encodes what remains.
• The trick is finding methods that allow
important information to be efficiently
extracted and represented.

2
Why do we need compression?
• Saving The Storage Space.
• Maximum Transmission Bandwidth Utility.
• Color image, 352x288 pixels “Full” color
depth: 24 bits per pixel (8 bits red, green,
blue) – 304128 bytes
• Reduced color depth: 12 bits per pixel
– 152064 bytes

3
Human Visual System (HVS)
• The human eye is not very sensitive to high
frequency changes especially in
photographic images, so the high frequency
data can, to some extent, be discarded.
• many of the pixels of a typical photographic
image contain little or no “useful” detail
(e.g. “flat” areas)

4
Fundamental Components of Compression
• Redundancy Reduction
– Removing duplication from the signal
source (Image)
• Irrelevancy reduction
– Omits parts of the signal that will not
be noticed by the signal receiver

5
Types of Redundancy
• Spatial redundancy
– correlation between adjacent pixels.
• Spectral redundancy
– Correlation between spectral bands.
• Temporal redundancy
– Correlation between adjacent frames
(video applications).

6
Some Factors Affecting Achievable Compression

• Sample parameters (spatial resolution, bit depth).


• Sensor characteristics (noise, spectral response).
• Scene content, including noise.
• Image size and viewing distance.
• Display characteristics (noise, light level, non-linearity)
• Post Processing (Sharpening, …
• Pre-Processing (image formation, registration)
• Observer (IA, machine)

7
Image and video coding Standards
• Why a standard ?
Like a language, a standard serves to facilitate
communication between men, man-machine and
machines

8
Standardization
• Two major international organizations have
been responsible for providing standards on
audio-visual coding
– International Organization for Standardization
(ISO)
– International Telecommunication Union (ITU)

9
Different Classes Of Compression
Techniques

• Two ways of classifying


compression techniques:
– Lossless Vs. Lossy compression.
– Predictive Vs. Transform coding

– Compression Ratio

10
11
12
JPEG 2000 family of standards

• JPEG (1992)
– Lossy and lossless, DCT-based
• JPEG-LS (1997)
– Lossless and near-lossless, prediction-based
• JPEG 2000 Part1 (2002)
– Lossy and lossless, wavelet-based
• JPEG 2000Part2 (2002)
– Provision for 3D extensions

13
JPEG 2000Part1

• JPEG 2000:main features


– Released in 2002
– High coding efficiency(20% more than JPEG)
– wavelet-based compression (also good for
compressed domain processing)
– seamless lossy-to-lossless compression
– highly scalable (inequality, resolution,
component)
– Easy alteration of the progression order
– Region of interest coding
14
JPEG 2000 Part2

• JPEG 2000Part2(extensions)
– supports arbitrary wavelet filters
– supports multi-component
transformations
• Multi-component support:
– Linear block transform(DCT, KLT,...)
– 3D wavelet transform
– predictive coding
15
What is ITU-T?
• Telecommunication standardization
• sector of ITU (Formerly CCITT)
• Study group 15 is responsible for video
• conference and video telephony
• Over 20 companies and research centers
• around the world actively participate
• Meets 3-5 times every year
• Proposes « Recommendations »
16
ITU-T Recommendations
• H.120 (1984)
– Video-conferencing over H1 channels
(1.5- 2Mb/s)
• H.261 (1988)
– Video-conferencing over ISDN lines
(p*64 Kb/s; p1…30)
• H.263 (1996)
– Video-telephony over POTS and Internet
(8-64 Kb/s)

17
18
19
Signal-to-Noise Ratio

20
INFORMATION THEORY
• ENTROPY
Entropy is a very important concept in
information theory and communications.
So is it in image and video compression.
We first define the information content
of a source symbol. Then we define
entropy as average information content
per symbol for a discrete memoriless
source.

21
Information Measure
• Consider a symbol with an occurrence probability
p. Its information content (i.e., the amount of
information contained in the symbol), I, is
defined as follows.

According to Equation, the information contained


within a symbol is a logarithmic function of its
occurrence probability. The smaller the
probability, the more information the symbol
contains.
22
Average Information per Symbol
The entropy, H, can be expressed as follows:

23
Coding Redundancy
• What is the meaning of VLC?

It is obvious that the average length of codeword in code 1,


Lavg,1, is three bits. The average length of codeword in code
2,Lavg,2, can be calculated as follows.

24
Huffman coding
• In summary, the Huffman coding algorithm consists of the
following steps.
1. Arrange all source symbols in such a way that their occurrence
probabilities are in a non increasing order.
2. Combine the two least probable source symbols:
• Form a new source symbol with a probability equal to the sum
of the probabilities of the two least probable symbols.
• Assign a binary 0 and a binary 1 to the two least probable
symbols.
3. Repeat until the newly created auxiliary source alphabet contains
only one source symbol.
4. Start from the source symbol in the last auxiliary source alphabet
and trace back to each source symbol in the original source
alphabet to find the corresponding codeword.
25
Example 5.9
Consider a source alphabet whose six source
symbols and their occurrence probabilities are
listed in Table 5.9. Figure 5.1 demonstrates the
Huffman coding procedure applied. In the
example, among the two least probable source
symbols encountered at each step we assign
binary 0 to the top symbol and binary 1 to the
bottom symbol.

26
27
Differential Coding
• SIMPLE PIXEL -TO-PIXEL DPCM

28
29
Block diagram of a practical pixel-to-pixel
differential coding system.

30
31
Image Coding based on
Linear Transform
Linear Transformation
• A linear transform is a mapping that converts
time domain (or spatial domain) digital signal
into frequency domain coefficients
• Signals represented in the frequency domain
have different properties that can be exploited
to facilitate efficient digital signal processing
• Transforms are useful for a wide range of
purposes, including convolution, enhancement,
feature detection, and compression
33
Transform Coding

34
35
DISCRETE FOURIER TRANSFORM (DFT)
• The forward and inverse transformation kernels of
the DFT are:

36
• for N = 4.

37
DISCRETE COSINE TRANSFORM (DCT)

38
DCT: discrete cosine transform
• DCT :discovered in 1974 by the research
community working on image compression.
• DCT :used in image compression in 1984.
• DCT :Technique for converting a signal into
elementary frequency components.
• DCT :Fourier related-transform similar to DFT
,but using real numbers only.
• DCT :Transform technique used for lossy
compression.

39
One-dimensional DCT

• Forward DCT (N-point DCT)


N −1
⎡ (2n + 1)kπ ⎤

2
X(k ) = c x (n ) cos ⎢ ⎥
N k
n =0 ⎣ 2 N ⎦

k = 0,1,................................N − 1

40
Inverse DCT (N-point IDCT)

N −1
⎡ ( 2 n + 1) k π ⎤
x ( n ) = ∑ c k X ( k ) cos ⎢ ⎥
k =0 ⎣ 2 N ⎦
n = 0 ,1,......... .......... ........ N − 1
⎧ 1
⎪ k =0
where c k = ⎨ 2
⎪⎩ 1 k ≠ 0

41
Vector-Matrix form for DCT

⎡ 0 ⎤ ⎡ ⎤⎡ 0 ⎤
⎢ 1 ⎥ ⎢ ⎥⎢ 1 ⎥
⎢ ⎥ ⎢ ⎥⎢ ⎥
⎢ 2 ⎥ 2⎢ ⎡ (2n + 1)kπ ⎤ ⎥ ⎢ 2 ⎥
⎢ ⎥ = ⎢c k cos ⎢ ⎥ ⎥ ⎢ ⎥
⎢ . ⎥ N⎢ ⎣ 2N ⎦⎥⎢ . ⎥
⎢ . ⎥ ⎢ ⎥⎢ . ⎥
⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎢⎣ N − 1⎥⎦ ⎣ ⎦ ⎢⎣ N − 1⎥⎦
X(k): Transform DCT Matrix x(n): Data
Vector (k x n) Vector
42
IDCT Matrix

⎡ 0 ⎤ ⎡ ⎤⎡ 0 ⎤
⎢ 1 ⎥ ⎢ ⎥⎢ 1 ⎥
⎢ ⎥ ⎢ ⎥⎢ ⎥
⎢ 2 ⎥ ⎢ ⎡ ( 2 n + 1) k π ⎤⎥⎢ 2 ⎥
⎢ ⎥ = ⎢ c k cos ⎢ ⎥⎥⎢ . ⎥
⎢ . ⎥ ⎢ ⎣ 2N ⎦ ⎢ ⎥

⎢ . ⎥ ⎢ ⎥⎢ . ⎥
⎢ ⎥ ⎢ ⎥⎦ ⎢⎢ N − 1⎥⎥
⎢⎣ N − 1⎥⎦ ⎣ ⎣ ⎦
IDCT Matrix
X(n) (n x k) X(k)

43
The Basis functions (vectors) of the
normalized 1D-DCT

k = 0
c(k , n) = 1 for
N 0 ≤ n ≤ N −1

2 ⎡ (2n + 1)kπ ⎤ 0 ≤ n ≤ n −1
c(k , n) = cos⎢ ⎥ for
N ⎣ 2 N ⎦ 1 ≤ k ≤ N −1

44
Multidimensional DCT (2D-DCT)

• One dimensional DCT is useful in


processing one-dimensional signals such
as Speech waveforms.

• Two dimensional DCT used for analysis


of two-dimensional signals such as
Images.

45
Two dimensional-DCT

2D-DCT(normalized)

2 N −1 M −1
⎡ (2n +1)uπ ⎤ ⎡ (2m +1)vπ ⎤
X (u, v) = cucv ∑∑ x(n, m) cos⎢ ⎥ cos⎢ ⎥
NM n=0 m=0 ⎣ 2N ⎦ ⎣ 2M ⎦
u = 0,1,2,.................N −1 ⎧1
⎪ l =0
cl = ⎨ 2
v = 0,1,2,.................M −1 ⎪⎩ 1 l ≠ 0

46
2D-IDCT(normalized)

2 N −1 M −1
⎡ (2n + 1)uπ ⎤ ⎡ (2m + 1)vπ ⎤
x(n, m) = cu cv ∑∑ X (u, v) cos⎢ ⎥ cos⎢ ⎥
NM n =0 m =0 ⎣ 2N ⎦ ⎣ 2M ⎦
n = 0,1,2,................N − 1 ⎧ 1
⎪ l =0
cl = ⎨ 2
m = 0,1,2,...............M − 1 ⎪⎩ 1 l ≠ 0

47
U1

Basis Images For (8x8) 2D- DCT

Vertical edges
DC

Horizontal edges

48
Slide 48

U1 User, 2/29/2008
Basis Images for 2D-DCT

• The 2D-DCT of 2D-data array results in


2D-DCT coefficients . These coefficients
represent the weights of the
corresponding basis images inherent in
the 2D- data array.

49
DCT-properties:

• Real arithmetic.
• Decomposing.
• Energy compaction.
• Orthogonality.
• Separability.

50
Decomposing Property for DCT

• 1D-DCT has Basis functions.


• 2D-DCT has Basis Images.

• Mapping of 2D array into 2D-DCT


domain implies decomposing the data
into the basis images of the DCT.

51
Energy Compaction

52
Orthogonality Property

• Because DCT is orthogonal ,so

−1
=
T
T T
Where T :the DCT (transform)
matrix

53
Orthogonality Property

⎡ DCT ⎤
X (k ) = ⎢ ⎥ x(n)
⎣matrix⎦
Transform vector data vector
54
Orthogonality Property

data vector Transform vector

⎡ IDCT ⎤
x(n) = ⎢ ⎥ X (k )
⎣matrix⎦
where T

⎡ IDCT ⎤ ⎡ DCT ⎤
=
⎢ matrix ⎥
⎣ ⎦ ⎢ matrix ⎥
⎣ ⎦
55
Separability Property of DCT
• Using separability property 2D-DCT can
implemented by a series of 1D-DCT

56
DCT-Based Image Compression

JPEG Encoder

JPEG Decoder

57
58
DCT (8x8) image block

59
Quantization
• A quantizer simply reduces the number of
bits needed to store the transformed
coefficients by reducing the precision of
those values.
• Quantization is a lossy process and is the
main source of compression in an
encoder.
• Quantization may be uniform or non-
uniform.
60
DCT Quantized matrix
σ
2
1 i, j
b =r+ log 2 1 / 64

⎢⎣ ∏ σ
i, j 2 ⎡ 2 ⎤
i, j i , j⎥

• The quantized DCT coefficients

⎛ S(u, v) ⎞
Sq (u, v) = Nearst integer ⎜⎜ ⎟⎟
⎝ Q(u, v) ⎠

where S(u,v) : DCT coefficients matrix


Q(u,v) :Quantization matrix 61
Quantization Matrix (look up tables)

Note: Larger values for high frequencies 62


Dequantization

• The quantization matrix needed to be stored in the


decoder for DCT coefficients reconstruction.

• The dequantized DCT coefficients:

R (u , v ) = S q (u , v )Q (u , v )

• The quantization error is the change in a quantity


after quantization and dequantization.

63
Zigzag scan
• The zigzag scan used to prepare the quantized DCT
coefficients for Entropy coding

64
Entropy Encoder

• It uses a model to accurately determine the


probabilities for each quantized value and coded
it with minimum possible number of bits.
• The Entropy (average information) of a source S

1
H ( s ) = ∑ pi log 2
i pi
65
Huffman Coding (VLC)

Note: Short codeword for frequent symbols 66


DC/AC coding
• DC coefficient is treaded separately from
AC coefficients because of its
importance.
• AC coefficients: Zigzag scanned then
coded using VLC.
• End of Block (EOB).

67
Blocking Artifacts
• Since the input image needs to be
“Blocked” correlation across the block
boundaries is not eliminated .This results
in noticeable “blocking artifacts”
particularly at low bit rates.

68
Example

69
70
71
72
Reconstructed Matrix

73
Reconstructed image with DC component
only, To show blocking artifacts

74
Compression Ratio (CR) & Image
quality
• CR =the ratio of the size of image before and
after compression.
=the ratio of bit-rates (bpp) before and after
compression.
• For lossy compression (CR) may be from10:1
up to 50:1 without significantly affecting the
image quality.
• At higher compression ratios image quality
degrades due to blocking artifacts.

75
Simulation Result (for CR=11.2460)
DCT-based
Original image image compression

CR = 11.2460
RMS = 4.1316

76
Simulation Result (for CR =53.4333)
Original image DCT-based
image compression

CR = 53.4333
RMS = 10.9662

77
DCT advantages

• High Compression Capability.


• Fast implementation, forward & reverse.
• The availability of Commercial hardware
Chips (VLSI chips).

78
DCT-disadvantages

• Can not used in lossless compression.

• Blocking Artifacts.

79
DCT Other applications:

• Speech coding.
• Image coding (BW compression)
• Image Enhancement ,Filtering.
• Video compression standards (MPEG).

80

You might also like