You are on page 1of 85

DIGITAL IMAGE PROCESSING

Textbook Link:
https://www.codecool.ir/extra/2020816204611411Digital.Im
age.Processing.4th.Edition.www.EBooksWorld.ir.pdf

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 1


IMAGE TRANSFORM
DIGITAL IMAGE PROCESSING

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 2


WHAT ?

IMAGE TRANSFORM
DIGITAL IMAGE PROCESSING

• Transformation is a function. A function that maps


one set to another set after performing some operations

• A function or operator that takes


an image as its input and produces an image as its output
19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 3
WHAT ?

IMAGE TRANSFORM
DIGITAL IMAGE PROCESSING

• Image Transform is representation of 2D signal


[Image Signals holds 2D visual information]

F(x,y) x,y is the two spatial dimension


19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ Can be represented to a plane 4
WHY ?

IMAGE TRANSFORM
DIGITAL IMAGE PROCESSING

• Image transforms are the basis of image processing and analysis

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 5


NEED FOR IMAGE TRANSFORM
• Efficient Representation of visual information leads to many image
processing Tasks
Efficient Representation :

Image Filtering The ability to capture


significant information
of an image in a
small description
Image Compression
Feature Extraction
Restoration
19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 6
NEED FOR IMAGE TRANSFORM
• Image processing application can be applied both in :
Spatial Domain
Frequency Domain • If the spatial domain image is transformed into another domain,
solution of any problem can be found easily

Change in problem representation can


help to solve the problem faster

a) ii*iii=vi b) 2*3=6

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 7


NEED FOR IMAGE TRANSFORM
Different Representation of same problem

• Spatial – Time
• Frequency- Frequency

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 8


NEED FOR IMAGE TRANSFORM
Different Representation of same problem

• Spatial – Time
• Frequency- Frequency

Input function f (in red) in the "time domain"


and converts it into
a new function f-hat (in blue) in the "frequency domain".

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 9


• If the spatial domain image is transformed into another domain in
which solution of any problem can be found easily

Transform
Image Another
transforms image N x N
Inverse
transform Coefficient matrix

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 10


Why transform?
• Better image processing
• Take into account long-range correlations in space
• Conceptual insights in spatial-frequency information.
what it means to be “smooth, moderate change, fast change, …”
• Fast computation: convolution vs multiplication
• Alternative representation and sensing
• Obtain transformed data as measurement in radiology images (medical and astrophysics),
inverse transform to recover image
• Efficient storage and transmission • Energy compaction means that the
• Energy compaction energy of Ax=y is more
• Pick a few “representatives” (basis) concentrated in some elements
• Just store/send the “contribution” from each basis compared to the distribution of
energy in x

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 11


APPLICATION OF IMAGE TRANSFORM

Image Enhancement

Image Compression

Feature Extraction and Representation

Pattern Recognition

Dimensionality Reduction

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 12


HOW?

IMAGE TRANSFORM
DIGITAL IMAGE PROCESSING

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 13


19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 14
TYPES OF IMAGE TRANSFORM
• DFT
• DCT
• WALSH
• HADAMARD
• SLANT
• HAAR
• KLT
• SVD
• RANDOM AND WAVELET

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 15


FOURIER

French mathematician
and physicist

Lived 1768 ‐ 1830

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 16


FOURIER SERIES
a function f(t) of a continuous variable, t, that is periodic with a period, T, can be expressed as the
sum of sines and cosines multiplied by appropriate coefficients. This sum, known as a Fourier series,
has the form

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 17


Fourier Transform
• Any periodic function can be decomposed into a summation of sines
and cosines

• Fourier transform—simple, powerful and widely used transform for


image enhancement and image reconstruction
19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 18
Fourier Transform

• Used widely in image processing

• The intensity of the image is transformed into frequency variation and


then to the frequency domain

• It is used for slow varying intensity images

• Such as the background of a passport size photo can be


represented as low-frequency components and the edges can
be represented as high-frequency components
12/19/2021 School of Computer Sciences 19
Fourier Transform
• Low-frequency components can be removed using filters of FT domain
• When an image is filtered in the FT domain, it contains only the edges
of the image
• And if we do inverse FT domain to spatial domain then also an image
contains only edges
• Fourier transform is the simplest technique in which edges of the image
can be fined
• The Fast Fourier transform (FFT) is a fast algorithm for computing the
discrete Fourier transform
12/19/2021 School of Computer Sciences 20
1D DISCRETE FOURIER TRANSFORM

X(n) DFT
X(k)
𝑵−𝟏 Frequency Domain
Spatial Domain 𝟐𝝅
−𝒋 𝑵 𝒌𝒏 : 0 ≤ 𝑘 ≤ 𝑁 − 1
𝒙 𝒌 = ෍𝒙 𝒏 𝒆
𝒏=𝟎

N= No: of Sample

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 21


1D DISCRETE FOURIER TRANSFORM
inverse

X(k) IDFT X(n)


𝑵−𝟏 Spatial Domain
Frequency Domain 𝟏 𝟐𝝅
𝒋 𝑵 𝒌𝒏
𝒙 𝒏 = ෍𝒙 𝒌 𝒆
𝑵 : 0 ≤n≤ 𝑁 − 1
𝒏=𝟎
N= No: of Sample

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 22


General Steps of Operation in Frequency Domain

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 23


2D Discrete Fourier Transform (2D DFT)
• Fourier transform of a 2D signal defined over a discrete finite
2D grid of size MxN
• Fourier transform of a 2D set of samples forming a
bidimensional sequence
• As in the 1D case, 2D-DFT, though a self-consistent
transform,
can be considered as a mean of calculating the transform of a
2D sampled signal defined over a discrete grid

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 24


2D Discrete Fourier Transform (2D DFT)

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 25


2D TRANSFORM

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 26


Properties of Fourier Transformation
Separability Rotation
Translation Distributive
Periodicity Scaling
Conjugate Convolution

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 27


Properties of Fourier Transformation
• We can do 2D Fourier transformation as two 1D
• Separability Fourier Transformation

• 2D Inverse Fourier transformation can also be


viewed as two 1D inverse Fourier Transform

• Advantage: Operation become much simpler


and less time complexity

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 28


Properties of Fourier Transformation
• Separability

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 29


Properties of Fourier Transformation
• Separability

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 30


Properties of Fourier
Transformation
• Translation (that is, delay) in the
• Translation time domain is interpreted as
complex phase shifts in the
frequency domain

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 31


Properties of Fourier Transformation
• Translation

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 32


Properties of Fourier Transformation

• Periodicity property says that


• Periodicity Discrete Fourier Transform and
inverse Discrete Fourier Transform
are periodic with a period N

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 33


Properties of Fourier Transformation
• Periodicity

(a) A 1-D DFT showing an infinite


number of periods

(b) (b) Shifted DFT obtained by


multiplying f(x ) by ( −1)x before
computing F(u )

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 34


Properties of Fourier Transformation
• Periodicity
(c) A 2-D DFT showing an infinite
number of periods. The area within
the dashed rectangle is the data array,
F(u,v) obtained with Eq.

with an image f(x,y ) as the input. This


array consists of four quarter periods.

(d) Shifted array obtained by


multiplying f (x,y) by (-1 )x+y before
computing F(u,v). The data now
contains one complete, centered
period, as in (b).
19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 35
Properties of Fourier Transformation

• Conjugate • Where F* indicate it complex


conjugate

• This property help to visualize


Fourier Spectrum

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 36


Properties of Fourier Transformation
• In optics, a conjugate plane or
conjugate focal plane of a given plane
P, is the plane P′ such that points on
P are imaged on P′.

• If an object is moved to the point


occupied by its image, then the moved
object's new image will appear at the
point where the object originated

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 37


Properties of Fourier
Transformation

• Rotation

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 38


Properties of Fourier Transformation

• Distributive
• DFT is distributive over
addition but not on
multiplication

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 39


Properties of Fourier
Transformation

• Scaling • If f(x,y) is multiplied by scalar


quantity a then its FT is also
multiplied by same scalar
quantity
Scaling is the method that is used to the change the
range of the independent variables or features of Scaling individual dimension
data. If we stretch a function by the factor in the time
domain then squeeze the Fourier transform by the
same factor in the frequency domain.

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 40


Properties of Fourier
Transformation

• Convolution • Convolution in spatial domain


is equivalent to multiplication
in frequency domain and vice
versa
• It includes the multiplication of two • the Fourier transform of the spatial
functions. The Fourier transform of a
convolution of two functions is the point-
convolution of f and h, is the
wise product of their respective Fourier product of their transforms
transforms.
19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 41
Fourier What is the basis of a image?
Any image can be expressed as linear combination of

Transformation matrices. for k,l=0,1,2,.... N-1 are called "basis images".


Therefore any image can be expanded in a series using a
complete set of basis images

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 42


Fourier
Transformation

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 43


Discrete Fourier Transformation

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 44


Discrete Fourier Transformation

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 45


Discrete Cosine Transforms(DCT)

12/19/2021 School of Computer Sciences 46


Discrete Cosine Transforms(DCT)

12/19/2021 School of Computer Sciences 47


DCT- Where is this used?

12/19/2021 School of Computer Sciences 48


DCT- Where is this used?

12/19/2021 School of Computer Sciences 49


DCT
• The transformation matrix of the most commonly encountered
form of the discrete cosine transform (DCT) is obtained by
substituting the inverse transformation kernal

12/19/2021 School of Computer Sciences 50


Discrete Cosine Transforms(DCT)

• In DCT, coefficients carry information about the pixels of the image

• Also, much information is contained using very few coefficients, and


the remaining coefficient contains minimal information

• These coefficients can be removed without losing information

• By doing this, the file size is reduced in the DCT domain

• DCT is used for lossy compression


12/19/2021 School of Computer Sciences 51
Properties of Discrete cosine transformation

• Real and Orthogonal: C=C* → C-1=CT

• Fast Transform

• Excellent Energy Compaction (Highly Correlated


Data)

the capability of a transform to redistribute the signal


energy into a small number of transform coefficients

12/19/2021 School of Computer Sciences 52


Discrete cosine transformation

12/19/2021 School of Computer Sciences 53


Walsh Transform

12/19/2021 School of Computer Sciences 54


Walsh Transform

12/19/2021 School of Computer Sciences 55


Walsh Transform

12/19/2021 School of Computer Sciences 56


Walsh Transform

12/19/2021 School of Computer Sciences 57


Walsh Transform

12/19/2021 School of Computer Sciences 58


Walsh Transform

12/19/2021 School of Computer Sciences 59


Walsh Transform
• The discrete Walsh transform of a function f (x),
denoted W(u)

• Walsh transform kernel is symmetric matrix having


orthogonal rows and columns

• One dimensional Walsh transform of a function f(x) can


be represented by W(x)

12/19/2021 School of Computer Sciences 60


• Inverse Walsh transform is almost identical to the forward transform

Properties of Walsh Transform:

• The Walsh Transform kernels are separable and symmetric

• It has energy compaction property but not so strong as DCT

12/19/2021 School of Computer Sciences 61


Walsh Transform -Application
• Walsh functions can be found wherever digit representations are used,
including
• Speech recognition
• Medical and biological image processing
• Digital holography.
• For example, the fast Walsh–Hadamard transform (FWHT) may be used in
the analysis of digital quasi-Monte Carlo methods.

12/19/2021 School of Computer Sciences 62


Hadamard Transform

• One dimensional equation for the Hardamard transform is

• H(u)=1/N ∑x=0 N-1 f(x)(-1) ∑i=0 n-1[b


i (x) bi (u)]

• The Hadamard Transform differs from the Walsh Transform only


in the order of basis functions.

12/19/2021 School of Computer Sciences 63


Hadamard Transform
• Extended versions of the Walsh and Hadamard Transforms are their
so-called ordered versions

• In these versions the order of basis functions has been rearranged so


that the sequence of the basis function increases by its index

• The Walsh-Hadamard transform is used in a number of applications,


such as image processing, speech processing, filtering, and power
spectrum analysis. It is very useful for reducing bandwidth storage
requirements and spread-spectrum analysis
12/19/2021 School of Computer Sciences 64
Haar Transform

• The Haar transform is the simplest of the wavelet transforms

• This transform cross-multiplies a function against the Haar wavelet


with various shifts and stretches, like the Fourier transform cross-
multiplies a function against a sine wave with two phases and many
stretches.

12/19/2021 School of Computer Sciences 65


Haar Transform
• The Haar transform is one of the oldest transform functions, proposed in 1910 by the Hungarian
mathematician Alfréd Haar.

• It is found effective in applications such as signal and image


compression in electrical and computer engineering as it provides a
simple and computationally efficient approach for analysing the local
aspects of a signal

12/19/2021 School of Computer Sciences 66


Haar Transform
The Haar transform is derived from the Haar matrix.

An example of a 4x4 Haar transformation matrix is:

The Haar transform can be thought of as a sampling process in which rows of the
transformation matrix act as samples of finer and finer resolution.

Compare with the Walsh transform, which is also 1/–1, but is non-localized.

12/19/2021 School of Computer Sciences 67


Haar Transform

• The Haar transform is based on the Haar functions, hk(z), which are
defined over the continuous, closed interval z ε [0, 1], and for k = 0, 1,
2 . . . , N-1, where N = 2n

• The first step in generating the Haar transform is to note that the
integer k can be decomposed uniquely as

• k = 2p + q - 1

12/19/2021 School of Computer Sciences 68


Haar Transform

12/19/2021 School of Computer Sciences 69


Haar Transform Properties

• The Haar transform is real and orthogonal

• The Haar transform is very fast. It can implement O(n)


operations on an N x 1 vector

• The mean vectors of the Haar matrix are sequentially ordered

• It has a poor energy deal for images

12/19/2021 School of Computer Sciences 70


Slant Transform
• The Slant transform matrix of order N x N is the recursive expression
Sn

• A new unitary transform called the slant transform

• specifically designed for image coding

• The transformation possesses a discrete basis vector which


efficiently represents linear brightness variations along an image line.
12/19/2021 School of Computer Sciences 71
Slant Transform Properties
• The slant transform is real and orthogonal

• S = S* S -1 = ST

• The slant transform is fast, it can be implemented in (N log2N) operations on an N x 1


vector

• The energy deal for images in this transform is rated in very good to excellent range

• The mean vectors for slant transform matrix S are not sequentially ordered for n ≥ 3

12/19/2021 School of Computer Sciences 72


KL Transform (Karhunen-loeve)

• The Karhunen-Loeve Transform or KLT was originally introduced as a


series expansion for continuous random processes by Karhunen and
Loeve

• For discrete signals Hotelling first studied what was called a method
of principal components, which is the discrete equivalent of the KL
series expansion

12/19/2021 School of Computer Sciences 73


• the KL Transform is also called the Hotelling Transform or the method
of principal components

• The term KLT is the most widely used

12/19/2021 School of Computer Sciences 74


Properties of KL Transform

• Its basis functions depend on the covariance matrix of the image, and
hence they have to recomputed and transmitted for every image

• Perfect decorrelation is not possible, since images can rarely be


modelled as realisations of ergodic fields

• There aren’t any computationally fast algorithms for its


implementation

12/19/2021 School of Computer Sciences 75


SVD TRANSFORM
• Handy mathematical technique that has application to many
problems

• The SINGULAR VALUE DECOMPOSITION for square matrices was


discovered independently by Beltrami in 1873 and Jordan in 1874

• It was extended to rectangular matrices by Eckart and Young in the


1930s

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 76


SVD TRANSFORM

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 77


SVD TRANSFORM
The SVD of a m-by-n matrix A is given by the formula :

A  UWV T

Where :
U is a m-by-n matrix of the orthonormal eigenvectors of
AAT
VT is the transpose of a n-by-n matrix containing the
orthonormal eigenvectors of ATA
W is a n-by-n Diagonal matrix of the singular values
which are the square roots of the eigenvalues of ATA
19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 78
SVD TRANSFORM
A technique for handling matrices (sets of equations) that do not have
an inverse.
This includes square matrices whose determinant is zero and all
rectangular matrices.

Common usages include computing the least-squares solutions, rank,


range (column space), null space and pseudoinverse of a matrix.

19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 79


SVD Applications
Image processing
[U,W,V]=svd(A)
NewImg=U(:,1)*W(1,1)*V(:,1)’
SVD Applications con’t
Digital Signal Processing (DSP)

• SVD is used as a method for noise reduction.

• Let a matrix A represent the noisy signal:


• compute the SVD,
• and then discard small singular values of A.

• It can be shown that the small singular values mainly represent the
noise, and thus the rank-k matrix Ak represents a filtered signal with
less noise.
SVD Applications
SVD approach can be used in
• Image Compression
• Face Recognition
• Watermarking
• Texture classification
19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 83
19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 84
19-12-2021 IMAGE TRANSFORM-DIP-SOCS-$P$ 85

You might also like