Digital Image Processing
(Code: 455)
National Institute of Technology Delhi
Contents
• Image Transforms
Terminology
• Image:
Image is the picture which are saved in electronic form e.g in our phone's gallery.
• Image - Any visual object that's modified or altered by a computer or an imaginary
object created using a computer.
• Photo:
Photo is a short form of photography. Basically photos are those pictures which are
captured via camera.
• Photo or photograph - Anything taken by a camera, digital camera, or photocopier.
• Pictures:
Pictures are the paintings or drawings of anything created by humans.
• Picture - A drawing, painting, or artwork created on a computer. A picture is also
used to describe anything created using a camera or scanner.
• While using these words in sentences:
All images of New year party are in my laptop.
I love taking photos and capturing all joyful moments.
My younger brother created the picture of Eiffel tower.
Terminology
• A picture can be a painting, drawing, or a thought such as “picture
this".
• A photo is done with a camera, e.g. a photo of a painting, or a printed
photo.
• An image is what you see in your screen, e.g. a photo of a picture.
Recap of Lecture
• Unitary transform
• Separable transform
• Kronecker Product
• Improvement of computational complexity
Outline
• Discrete Fourier transformation
• 1D and 2D
• Separable DFT
• Fast Fourier Transform
Kronecker Products
If 𝐴 and 𝐵 are 𝑀1 × 𝑀2 and 𝑁1 × 𝑁2 matrices then Kronecker
product of 𝐴 and 𝐵 is defined as
𝑎0,1 𝐵 … 𝑎0,𝑀2 𝐵
𝐴⨂𝐵 = ⋮ ⋱ ⋮
𝑎𝑀1−1,0 𝐵 … 𝑎𝑀1−1,𝑀2−1 𝐵
𝑀1 × 𝑀2 block matrix of dimension 𝑁1 × 𝑁2
If 𝑀1 = 𝑀2 = 𝑁1 = 𝑁2 = 𝑁
Computational complexity?? Fast image transforms
Validation using Basis images
𝑢 1,0 = 𝑎∗ 0,1 𝑣 0,0 𝑎∗ 0,0 + 𝑎∗ 0,1 𝑣 0,1 𝑎∗ 1,0 + 𝑎∗ 1,1 𝑣 1,0 𝑎∗ 0,0 +
𝑎∗ 1,1 𝑣 1,1 𝑎∗ 1,0
1 3
= 2+ 3 +⋯
2 2
𝑁−1 𝑁−1
∗
Verification using: 𝑢 𝑚, 𝑛 = 𝑣 𝑘, 𝑙 𝑎𝑘,𝑙 𝑚, 𝑛
𝑘=0 𝑙=0
Basis images
Real part of the Fourier
transform basis
images.
Properties of Unitary transform
• Energy Conservation
𝑣 = 𝐴𝑢
Energy of an 1D signal should be preserved, 𝑣 2 = 𝑢 2
𝑁−1
𝑣 2 = 𝑣(𝑘) 2 = 𝑣Ԧ ∗𝑇 𝑣Ԧ
𝑘=0
• Energy compaction
• Decorrelation
Introduction
• 1-D Unitary transform
𝑁−1
𝑣 𝑘 = 𝑢 𝑛 𝑎(𝑘, 𝑛) 0 ≤ 𝑘 ≤ 𝑁 − 1
𝑛=0
Transformation matrix Forward transformation
to be chosen
appropriately 𝑁−1
𝑢 𝑛 = 𝑣 𝑘 𝑎∗ (𝑘, 𝑛) 0≤𝑛 ≤𝑁−1
𝑘=0
Reverse transformation
Discrete Fourier Transformation (DFT)
• Let the transformation matrix be defined as
−𝑗2𝜋𝑘𝑛
𝑎 𝑘, 𝑛 = exp
𝑁
𝑁−1
−𝑗2𝜋𝑘𝑛
𝑣 𝑘 = 𝑢 𝑛 exp
𝑁
𝑛=0
For ease of notation
𝑁−1
𝑣 𝑘 = 𝑢 𝑛 𝑊𝑁𝑘𝑛
𝑛=0
−𝑗2𝜋
where, 𝑒𝑥𝑝 = 𝑊𝑁
𝑁
Inverse DFT
• Then the inverse DFT will be defined as:
𝑁−1
𝑢 𝑛 = 𝑣 𝑘 𝑊𝑁−𝑘𝑛
𝑘=0
Is the transformation unitary?
𝑁−1
𝑣 𝑘 = 𝑢 𝑛 𝑊𝑁𝑘𝑛
𝑛=0
𝑁−1
1
𝑢 𝑛 = 𝑣 𝑘 𝑊𝑁−𝑘𝑛
𝑁
𝑘=0
Unitary DFT
• Unitary forward and reverse DFT equations are defined as
𝑁−1
1
𝑣 𝑘 = 𝑢 𝑛 𝑊𝑁𝑘𝑛
√𝑁 𝑛=0
𝑁−1
1
𝑢 𝑛 = 𝑣 𝑘 𝑊𝑁−𝑘𝑛
√𝑁 𝑘=0
Using matrix notation
1
𝑣Ԧ = F𝑢 where, F = 𝑊𝑁𝑘𝑛
√𝑁
Is matrix used for DFT Unitary?
1 1 … 1
𝑣(0) 2𝜋 2𝜋 𝑢(0)
−𝑗 𝑁 ×1 −𝑗 𝑁 ×(𝑁−1)
⋮ 1 𝑒 … 𝑒 ⋮
1 2𝜋 2𝜋
𝑣(𝑘) = 1 𝑒 −𝑗 𝑁 ×2
… 𝑒 −𝑗 𝑁 ×2(𝑁−1) 𝑢(𝑛)
⋮ √𝑁 ⋮
⋮ ⋮ ⋱ ⋮
𝑣(𝑁 − 1) 2𝜋
−𝑗 𝑁 ×(𝑁−1)
2𝜋
−𝑗 𝑁 × 𝑁−1 2
𝑢(𝑁 − 1)
1 𝑒 … 𝑒
Magnitude of each row is equal to 1
𝑁−1 𝑁−1
𝑗2𝜋𝑥1 𝑞 𝑗2𝜋𝑥1 𝑞
exp − exp = 1=𝑁
𝑁 𝑁
𝑞=0 𝑞=0
Rows are orthogonal to each other
2-D DFT
Forward transformation
𝑁−1 𝑁−1
𝑣 𝑘, 𝑙 = 𝑢 𝑚, 𝑛 𝑊𝑁𝑘𝑚+𝑙𝑛
𝑚=0 𝑛=0
where, 0 ≤ 𝑘, 𝑙 ≤ 𝑁 − 1
Reverse transformation
𝑁−1 𝑁−1
− 𝑘𝑚+𝑙𝑛
𝑢 𝑚, 𝑛 = 𝑣 𝑘, 𝑙 𝑊𝑁
𝑘=0 𝑙=0
where, 0 ≤ 𝑚, 𝑛 ≤ 𝑁 − 1
Separable 2-D DFT
𝑁−1 𝑁−1
1
𝑣 𝑘, 𝑙 = 𝑢 𝑚, 𝑛 𝑊𝑁𝑘𝑚+𝑙𝑛
𝑁
𝑚=0 𝑛=0
𝑁−1 𝑁−1
1
𝑣 𝑘, 𝑙 = 𝑢 𝑚, 𝑛 𝑊𝑁𝑘𝑚 𝑊𝑁𝑙𝑛
𝑁
𝑚=0 𝑛=0
𝑁−1 𝑁−1
1
𝑣 𝑘, 𝑙 = 𝑊𝑁𝑘𝑚 𝑢 𝑚, 𝑛 𝑊𝑁𝑙𝑛
𝑁
𝑚=0 𝑛=0
Significance of Separability
𝑁−1 𝑁−1
1
𝑣 𝑘, 𝑙 = 𝑊𝑁𝑘𝑚 𝑢 𝑚, 𝑛 𝑊𝑁𝑙𝑛
𝑁
𝑚=0 𝑛=0
𝑁−1
1-D case: 𝑣 𝑘 = 𝑢 𝑛 𝑊𝑁𝑘𝑛
𝑛=0
Using the 1D analogy
𝑁−1
𝑣 𝑚, 𝑙 = 𝑢 𝑚, 𝑛 𝑊𝑁𝑙𝑛
𝑛=0
𝑁−1
1
𝑣 𝑘, 𝑙 = 𝑣 𝑚, 𝑙 𝑊𝑁𝑘𝑚
𝑁
𝑚=0
Visualization of separability
(0,0) (0,0)
Transform over 𝑙
𝑛
column for
each row
𝒖(𝒎, 𝒏) 𝒗(𝒎, 𝒍)
𝑚 Input image 𝑚
(0,0) Transform
𝑙 over rows
for each
𝒗(𝒌, 𝒍) columns
𝑘 DFT image
Magnitude and Phase of DFT
Matrix of Complex values: a + 𝑗𝑏
Magnitude:
Phase:
Input image Magnitude Phase angle
Illustration of reconstruction
Input Image 1 Phase angle of Reconstructed only
(Woman) Input (IPA1) using IPA1
Reconstructed only
using the
magnitude
Image Transforms
• The series coefficients v (k,l) give a representation of the original
sequence u (m,n) and are useful in filtering, data compression,
feature extraction, and other analyses.
• Here Slides from Dr. A. k. Jain
From DFT to DCT (Discrete Cosine Transform)
DFT of any real and symmetric sequence contains
only real coefficients corresponding to the cosine
terms of the series
Construct a new symmetric sequence y(n) of length
2N out of x(N) of length N
y(n)= x(n), 0 n N-1,
y(n)= x(2N-1-n), N n 2N-1
Y(n) is symmetrical about n= N-(1/2)
From DFT to DCT (Cont.)
DCT has a higher compression ration than DFT
- DCT avoids the generation of spurious spectral
components
From DFT to DCT (Cont.)
1-D DCT
The constants are often defined differently
1-D 16-Point DCT Basis Vectors
2-D DCT
Two Examples of 2-D DCT
8x8 DCT
8x8 DCT Basis Function
An Example of 8x8 DCT
2-D DCT Coefficients
Amplitude Distribution of DCT Coefficients
Histogram for 8x8 DCT coefficient amplitudes
measured for natural images:
DC coefficient is typically uniformly distributed
For the other AC coefficients, the distribution
resembles a Laplacian pdf
1D DCT
forward transform inverse transform
−1
y N 1 = CxN 1 xN 1 = C yN 1
Properties
• Real and orthogonal
C = C* C−1 = CT
• excellent energy compaction property
• DCT is NOT the real part of DFT
Fact The real and imaginary parts of DFT are
generally not orthogonal matrices
• fast implementation available: O(Nlog2N)
2-D DCT
SINE TRANSFORM
KARHUNEN–LOEVE (KL) TRANSFORM
• The KL transform is a reversible linear transform that exploits the
statistical properties of a vector representation of i/p.
• The basic functions of the KL transform are orthogonal eigen
vectors of the covariance matrix of a data set.
• A KL transform optimally decorrelates the input data. After a KL
transform, most of the ‘energy’ of the transform coefficients is
concentrated within the first few components.
• This is the energy compaction property of a KL transform.
• Also called the Hotelling transform or Eigen Vector Transform
or the method of principal components.
• In DCT/DFT, We have fixed size matrix but in KL transform, the
transition matrix (autocorrelation matrix R ) depends on input
data/image.
• It is a statistical based method.
SINGULAR VALUE DECOMPOSITION