DIGITAL IMAGE
PROCESSING MODULE-II
PARVATHY LAKSHMY
FACULTY
ELECTRICAL DEPARTMENT
VJTI
IMAGE TRANSFORMS
• Representation of a 2D signal(Image signal holds 2D visual information)
• Representation of visual information-foundation of many image processing tasks like
image filtering, image compression and feature extraction etc
• Efficiency of Representation: Ability to capture significant information of an image in a
small description.
• Image transforms are used in image processing and image analysis
• Transform-Mathematical tool which allow us to move from one domain to another
• (generally, time/spatial domain → Frequency domain)
IMAGE TRANSFORMS
• Reason for migration-Perform task at hand in an easier manner.
• Other Advantages of transforming image:
➢ May isolate critical components of image pattern so that they are directly accessible for
analysis
➢ May place the image data in a more compact form so that it can be stored and
transmitted efficiently
➢ Useful for fast computation of 2D convolution and correlation
➢ Change the representation of the signal by projecting it on to a set of basis functions
IMAGE TRANSFORMS
➢ Transforms do not change the information content present in the signal
➢ Transform is reversible-we can revert to the initial domain
➢ Most of the image transforms-Fourier transform, Discrete Cosine transform, Wavelet
transform etc give information about the frequency contents in an image
• Definition:
• Image Transform=Operation to change the default representation space of a digital
image(spatial domain->another domain) so that all the information present in the image
is preserved in the transformed domain, but represented differently
NEED OF TRANSFORMS
Mathematical Convenience:
• Every action in time domain will have an impact in frequency domain
Eg: Convolution in time domain=Multiplication in frequency domain
To extract more information:
• Transforms allow us to extract more relevant information
CLASSIFICATION OF IMAGE TRANSFORMS
Based upon the nature of basis functions:
➢ Transforms with sinusoidal orthogonal basis functions
➢ Transforms with non- sinusoidal orthogonal basis functions
➢ Transforms whose basis functions depends on the statistics of the input data
➢ Transforms whose basis functions are capable of representing the directional information
present in the image
VARIOUS IMAGE TRANSFORMS
• 2D Discrete Fourier Transform
• Discrete Cosine Transform
• Haar Transform
• Walsh Transform
• Hadamard Transform
• Slant Transform
FOURIER TRANSFORM
• Image is a spatially varying function
f(x,y)
• For analyzing spatial variations, one
way is to decompose an image in to a
set of orthogonal functions( Fourier
functions)
• Example of 1D Signal
1
• 𝑔 𝑡 = sin 2𝜋𝑓𝑡 + 3 sin 2𝜋(3𝑓)𝑡
FOURIER TRANSFORM
• Thus, a Fourier transform is used to transform an intensity image in to the domain of spatial
frequency
1D FOURIER TRANSFORM
• Represents the signal as infinite weighted sum of an infinite number of sinusoids
• For a continuous time signal x(t), the fourier transform is defined as 𝑋 Ω
• Continuous time Fourier transform(CTFT) is defined as
• A continuous time signal x(t) is converted to discrete rime signal x(nT) by sampling process
where T is the sampling interval.
1D FOURIER TRANSFORM
• The Fourier transform of a finite energy discrete time signal x(nT) is given by
• Where 𝑋 𝑒 𝑗𝑤 is known as Discrete-Time Fourier Transform(DTFT) and is a continuous
function of 𝑤
1D FOURIER TRANSFORM
• The Discrete Fourier Transform(DFT) of a finite duration sequence x(n)is defined as
• Where k= 0,1,2,………..N-1
• The DFT is a discrete frequency representation that projects a discrete signal onto a
basis of complex sinusoids
2D DISCRETE FOURIER TRANSFORM
• The 2D-DFT of a rectangular image f(m,n) of size MXN is represented as F(k,l)
• Where F(k,l) is defined as
2D DISCRETE FOURIER TRANSFORM
• For a square image f(m,n) of size NXN, the 2D DFT is defined as
• The Inverse 2D Discrete Fourier Transform is given by
2D DISCRETE FOURIER TRANSFORM
• Fourier transform F(k,l) is given by
𝐹 𝑘, 𝑙 = 𝑅 𝑘, 𝑙 + 𝑗𝐼 𝑘, 𝑙
Where R(k,l) represents the real part of the spectrum and I(k,l) represents the imaginary
part.
The Fourier transform F(k,l) can be represented in polar coordinates as
where 𝐹 𝑘, 𝑙 = (𝑅2 𝐹 𝑘, 𝑙 + 𝐼2 𝐹 𝑘, 𝑙 )1/2 ---Magnitude Spectrum of Fourier
Transform
2D DISCRETE FOURIER TRANSFORM
𝐼{𝐹 𝑘,𝑙 }
• 𝜑 𝑘, 𝑙 = 𝑡𝑎𝑛−1 is the phase angle or phase spectrum. Here R{F(k,l)}, I{F(k,l)},
𝑅{𝐹 𝑘,𝑙 }
I{F(k,l)} are the real and imaginary parts of F(k,l) respectively.
• The computationally efficient form of DFT is the Fast Fourier Transform (FFT).
• There are two possible representations of the FFT of an image which are
• (a) standard representation, and
• (b) optical representation.
2D DISCRETE FOURIER TRANSFORM
• In the standard representation, high frequencies are grouped at the centre of the image
while the low frequencies are located at the edges which are illustrated in Fig. 4.3.
• The null frequency is in the upper-left corner of the image.
• The frequency range is given by [0,N]X [0,M]
• M-Horizontal Resolution of Image
• N-Vertical Resolution of Image
PROPERTIES OF 2D DISCRETE FOURIER TRANSFORM
• Seperable Property:
• Allows a 2D transform to be computed in two steps by successive 1D operations on
rows and columns of an image.
−𝑗2𝜋𝑚𝑘/𝑀 −𝑗2𝜋𝑛𝑙/𝑁
σ𝑀−1 𝑁−1 𝑓(𝑚, 𝑛)𝑒 𝑒
• F k, l = σ
𝑚=0 𝑛=0
−𝑗2𝜋𝑛𝑙/𝑁 )𝑒 −𝑗2𝜋𝑚𝑘/𝑀
σ𝑀−1 𝑁−1 𝑓(𝑚, 𝑛)𝑒
• F k, l = 𝑚=0 (σ𝑛=0
• F k, l = σ𝑀−1
𝑚=0 𝐹 𝑚, 𝑙 )𝑒
−𝑗2𝜋𝑚𝑘/𝑀 = F k, l
PROPERTIES OF 2D DISCRETE FOURIER TRANSFORM
• Performing a 2D transform is
➢ Performing 1D transform on each row of image f(m,n) to get F(m,l)
➢ Performing 1D transform on each coloumn of image F(m,l) to get F(k,l)
▪ Main advantage of separable property:
▪ Fourier transform of any dimension can be performed by applying a 1D transform on
each dimension
PROPERTIES OF 2D DISCRETE FOURIER TRANSFORM
Spatial Shift Property:
• The 2D DFT of a shifted version of the image 𝑓(𝑚, 𝑛) ie 𝑓(𝑚 − 𝑚0 , 𝑛), is given by
Where 𝑚0 represents the number of times that the function 𝑓(𝑚, 𝑛) is shifted
PROPERTIES OF 2D DISCRETE FOURIER TRANSFORM
Periodicity Property:
• The 2D DFT of a function 𝑓(𝑚, 𝑛) is said to be periodic with period N if
𝐹(𝑘, 𝑙) → 𝐹(𝑘 + 𝑝𝑁, 𝑙 + 𝑞𝑁)
PROPERTIES OF 2D DISCRETE FOURIER TRANSFORM
Convolution Property:
• Convolution of two sequences x(n) and h(n) is defined as
• Two-dimensional convolution of two arrays or matrices f(m,n) and g(m,n) is given by
PROPERTIES OF 2D DISCRETE FOURIER TRANSFORM
Correlation Property:
• Find relative similarity between two signals.
• Similarity of a signal to itself ----Autocorrelation
• Similarity between two different signals----Cross Correlation
• Cross correlation of two sequences x(n) and h(n) ------Performing the convolution of
one sequence with folded version of other sequence
PROPERTIES OF 2D DISCRETE FOURIER TRANSFORM
Scaling Property:
• Scaling is used to increase or decrease the size of an image
• Expansion of signal in one domain is compression of a signal in another domain
• The 2D DFT of a function 𝑓 𝑚, 𝑛 is defined as
• Scaling theorem tells that compression in one domain produces corresponding expansion
in the Fourier domain(frequency domain) and vice versa
PROPERTIES OF 2D DISCRETE FOURIER TRANSFORM
Conjugate Symmetry Property:
• If the DFT of f(m,n) is F(k,l) then DFT [𝑓 ∗ (𝑚, 𝑛)] = 𝐹 ∗ (−𝑘, −𝑙)
𝐹 𝑘, 𝑙 = 𝐹 ∗ −𝑘, −𝑙
PROPERTIES OF 2D DISCRETE FOURIER TRANSFORM
Multiplication by Exponential:
• If the DFT of 𝑓 𝑚, 𝑛 is 𝐹 𝑘, 𝑙 then
- -
PROPERTIES OF 2D DISCRETE FOURIER TRANSFORM
Rotation Property:
• The rotation property states that if a function is rotated by the angle, its Fourier
transform also rotates by an equal amount.
PROBLEMS-2D DFT
Compute the 2D DFT of a given image segment
100 0
A=
15 255
Obtain the DFT transformed matrix for the given 2X2 Image matrix.
DISCRETE COSINE TRANSFORM
• DFT is popular due to its computational efficiency
• Disadvantages for some applications:
➢ It is complex-Use of complex coefficients
➢ Poor energy compaction
• DCT is the member of the family of real valued discrete sinusoidal unitary transforms
• Consists of a set of basis vectors that are sampled cosine functions.
• DCT- Technique for converting a signal to elementary frequency components and
widely used in image compression
DISCRETE COSINE TRANSFORM
• If x[n] is a signal of length N, The fourier transform of x[n] is given by X[k]
• Where k varies between 0 to N-1
• Consider the extension of 𝑥 𝑛 denoted by 𝑥𝑒 [𝑛] so that length of the sequence is 2N.
• Sequence x[n] can be extended in two ways
PROPERTIES OF DISCRETE COSINE TRANSFORM
• DCT is real and orthogonal
• If A is a DCT matrix of order N and if matrix A is orthogonal, then
𝑨 × 𝑨𝑻 = 𝑰
• DCT has excellent energy compaction for highly correlated data
• Separable Property: 2D DCT of an image can be computed in two steps by successful
1D operations of rows and columns of an image
SHORT TIME FOURIER TRANSFORM(STFT)
• The STFT is a modified version of the Fourier transform.
• The Fourier transform separates the input signal into a sum of sinusoids of different
frequencies and identifies their respective amplitudes.
• Thus, the Fourier transform gives the frequency–amplitude representation of an input
signal.
• The Fourier transform is not an effective tool to analyse non-stationary signals.
SHORT TIME FOURIER TRANSFORM(STFT)
• STFT and wavelet transforms are effective tools to analyse non-stationary signals.
• In STFT, the non-stationary signal is divided into small portions, which are assumed to be
stationary.
• This is done using a window function of a chosen width, which is shifted and multiplied
with the signal to obtain small stationary signals.
STFT: SHORT TIME FOURIER TRANSFORM
• Time- Frequency localization depends on window size
➢ Wide Window-Good frequency localization, poor time localization
➢ Narrow Window-Good time localization but poor frequency localization
STFT-DRAWBACKS
• The main drawback of STFT is that once a particular size time window is chosen, the
window remains the same for all frequencies.
• To analyse the signal effectively, a more flexible approach is needed where the window
size can vary in order to determine more accurately either the time or frequency
information of the signal.
• This problem is known as the resolution problem
WHAT IS A WAVELET?
• A wave is an oscillating function of time or space that is periodic.
• The wave is an infinite length continuous function in time or space.
• In contrast, wavelets are localised waves.
• A wavelet is a waveform of an effectively limited duration that has an average value of
zero.
WHAT IS A WAVELET?
• A function that “waves” above and below the x-axis with the following properties:
➢ Varying frequency
➢ Limited Duration
➢ Zero Average Value
▪ In contrast to sinusoids, used by FT, which have infinite duration and constant frequency.
WAVELET
• A function ψ(x) can be called a wavelet if it posses the following properties:
❖The function integrates to zero, or equivalently, its Fourier transform denoted as ψ(ω) is
zero at the origin: This implies that 𝜑 𝑤 = 0|𝑤=0 in the frequency domain.
This equation suggests that the function is either oscillatory or has a wavy appearance
WAVELET
❖It is square integrable, or equivalently, has finite energy:
• Implies that most of the energy in ψ(x) is confined to a finite interval, or in other words,
ψ(x) has good space localisation. Ideally, the function is exactly zero outside the finite
interval
WAVELET
❖ The Fourier transform ψ(w) must satisfy the admissibility condition given by:
• This equation useful in formulating the inverse wavelet transform.
• From above equation it is obvious that ψ(ω) must have a sufficient decay in frequency. This means that the Fourier transform of
a wavelet is localised, that is, a wavelet mostly contains frequencies from a certain frequency band.
• Since the Fourier transform is zero at the origin, and the spectrum decays at high frequencies, a wavelet has a bandpass
characteristic.
• Thus a wavelet is a ‘small wave’ that exhibits good time–frequency localisation.
WAVELET
• A family of wavelets can be generated by dilating and translating the mother wavelet ψ(x)
which is given by:
• Here, a is the scale parameter and b is the shift parameter.
WAVELET TRANSFORM
• The wavelet transform was developed to overcome the shortcomings of the short-time
Fourier transform, which can be used to analyse non-stationary signals
• Wavelet transform uses a multi-resolution technique by which different frequencies are
analysed with different resolutions.
• The wavelet transform is generally termed mathematical microscope in which big wavelets
give an approximate image of the signal, while the smaller wavelets zoom in on the small
details.
• The basic idea of the wavelet transform is to represent the signal to be analysed as a
superposition of wavelets.
WAVELET TRANSFORM
• Uses a variable length window
• Eg: Narrower windows are more appropriate at high frequencies
Wider windows are more appropriate at low frequencies
CONTINUOUS WAVELET TRANSFORM
• Continuous wavelet transform of a 1D signal x(t) is given by:
• The continuous wavelet transform is a function of two variables a and b.
• Here, a is the scaling parameter and b is the shifting parameter.
• ψ(t) is the mother wavelet or the basis function and it is used as a prototype for generating
all the basis functions.
CONTINUOUS WAVELET TRANSFORM
• The translation parameter or the shifting parameter b gives the time information in the
wavelet transform.
• It indicates the location of the window as it is shifted through the signal.
• The scale parameter a gives the frequency information in the wavelet transform.
• A low scale corresponds to wavelets of smaller width, which gives the detailed
information in the signal.
• A high scale corresponds to wavelets of larger width which gives the global view of the
signal.
CONTINUOUS WAVELET TRANSFORM
• The inverse 1D continuous wavelet transform is given by:
• The wavelet transform of a signal using CWT----Changing the scale of analysis window,
shifting the window in time, multiplying the signal and integrating the result over
Fourier Transform Vs Wavelet Transform
2D CONTINUOUS WAVELET TRANSFORM
• 2D continuous wavelet transform of the image f (x, y) is given by
where m, n are shifting parameters and a is the scaling parameter.
DISCRETE WAVELET TRANSFORM
• The Discrete Wavelet Transform (DWT) is obtained by filtering the signal through a
series of digital filters at different scales.
• The scaling operation is done by changing the resolution of the signal by the process of
subsampling.
• The DWT can be computed using either convolution-based or lifting-based procedures.
In both methods, the input sequence is decomposed into low-pass and high-pass sub-
bands, each consisting of half the number of samples in the original sequence.
TYPES OF WAVELETS
HAAR WAVELET
• The Haar wavelet was introduced by Haar in 1910. It is a bipolar step function. The
expression of the Haar wavelet is given by:
HAAR WAVELET
• Haar wavelet is a real function, anti-
symmetric with respect to t = 1/2
• The Haar wavelet is discontinuous
in time.
• The Haar wavelet is localised in the
time domain, but it has poor
localisation in the frequency domain.
HAAR TRANSFORM
Haar Scaling Haar Wavelet
• The Haar transform is based on a
class of orthogonal matrices whose
elements are either 1, –1, or 0
multiplied by powers of √2
• The Haar transform is a
computationally efficient transform
as the transform of an N-point
vector requires only 2(N – 1)
additions and N multiplications.
ALGORITHM FOR HAAR BASIS FUNCTION
The algorithm to generate Haar basis is given below:
• Step 1: Determine the order of N of the Haar basis.
• Step 2: Determine n where n = 𝑙𝑜𝑔2 N
• Step 3: Determine p and q.
➢0 ≤ 𝑝 ≤ 𝑛 − 1
➢ 𝐼𝑓 𝑝 = 0 𝑡ℎ𝑒𝑛 𝑞 = 0 𝑜𝑟 𝑞 = 1
➢ 𝐼𝑓 𝑝 ≠ 0, 1 ≤ 𝑞 ≤ 2𝑝
ALGORITHM FOR HAAR BASIS FUNCTION
• Step 4: Determine k
𝑘 = 2𝑝 + 𝑞 − 1
• Step 5: Determine Z
• Step 6:
ALGORITHM FOR HAAR BASIS FUNCTION
• Otherwise:
PROPERTIES OF HAAR TRANSFORM
• The Haar transform is real and orthogonal
• The Haar transform is a very fast transform.
• On an NX1 vector it can be implemented in O(N) operations.
• The basis vectors of the Haar matrix are sequency ordered.
• The Haar transform has poor energy compaction for images.
WALSH TRANSFORM
• Fourier analysis-Representation of a signal by a set of orthogonal sinusoidal waveforms.
• The coefficients of this representation are called frequency components, and the
waveforms are ordered by frequency.
• Walsh in 1923 introduced a complete set of orthonormal square-wave functions to
represent these functions.
• The computational simplicity of the Walsh function is due to the fact that Walsh functions
are real and they take only two values which are either +1 or –1.
1D WALSH TRANSFORM
• Suppose we have a function f(x), x=0,….N-1, where N=2𝑛
• We use binary representations for x
• We need n bits to represent them
• 𝑥10 = (𝑏𝑛−1 𝑥 … … … … . 𝑏0 𝑥 )2
WALSH TRANSFORM
WALSH TRANSFORM
• The one-dimensional Walsh transform basis can be given by the following equation:
• n-time index,
• k represents the frequency index
• N represents the order.
WALSH TRANSFORM
• Also, m-number bits to represent a number
• 𝒃𝒊 𝒏 − 𝑖𝑡ℎ (from LSB) bit of the binary value, of n decimal number represented in
binary.
• The value of m is given by m =𝑙𝑜𝑔2 𝑁
• The two-dimensional Walsh transform of a function f (m, n) is given by:
WALSH TRANSFORM
HADAMARD TRANSFORM
• The Hadamard transform is basically the same as the Walsh transform except the rows
of the transform matrix are re-ordered.
• The elements of the mutually orthogonal basis vectors of a Hadamard transform are
either +1 or –1, which results in very low computational complexity in the calculation of
the transform coefficients.
• Hadamard matrices are easily constructed for N = 2𝑛 by the following procedure
HADAMARD TRANSFORM
• The order N = 2 Hadamard matrix is given as:
• The Hadamard matrix of order 2N can be generated by Kronecker product operation:
HADAMARD TRANSFORM
• Substituting N=2 in above equation:
• Substituting N=4 in above equation
SLANT TRANSFORM
• The slant transform is an orthogonal transform containing sawtooth waveforms or ‘slant’
basis vectors.
• Specifically designed for image coding
• A slant basis vector that is monotonically decreasing in constant steps from maximum to
minimum has the sequency property and has a fast computational algorithm.
• Let 𝑆𝑁 denote an NXN slant matrix with 𝑁 = 2𝑛 Then
SLANT TRANSFORM
• The 𝑆4 matrix is obtained by the following operation
1
• If a=2b and b= the slant matrix is given by :
5
SLANT TRANSFORM
SLANT TRANSFORM
• From the sequency property, the rows are ordered by the number of sign changes.
• The slant transform reproduces linear variations of brightness very well.
• However, its performance at edges is not as optimal as the KLT or DCT.
• Because of the ‘slant’ nature of the lower order coefficients, its effect is to smear the
edges