Faculty of Electrical Engineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit
DIGITAL IMAGE PROCESSING (DIP)
Farah Torkamani Azar
Faculty of Electrical Enginerring(Velenjak)
Shahid Beheshti University
f-torkamani@sbu.ac.ir,
farahtorkamaniazar@gmail.com
Section 3: 1-Image Transforms (DFT)
Fall 1402
Fall 2023
F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 1
Faculty of Electrical Engineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit
Outlier
In all parts, we will use the definitions in MATLAB.
Students can also use Python software.
Discrete Fourier Transform (DFT)
Discrete Cosine Transform (DCT)
Walsh-Hadamard Transform
Wavelet Transform
Hotelling Transform
Radon Transform
F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 2
Faculty of Electrical Engineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit
1-D Transform Basis: Basis Vectors
Simple Cartesian Basis Vectors





a0
a1
.
.
.
an−1





= a0





1
0
.
.
.
0





+ a1





0
1
.
.
.
0





+ · · · + an−1





0
0
.
.
.
1





=
n−1
X
i=0
ai.vi,
requires vT
i .vj = δ(i − j)
A vector space V is defined as a subset v0, ..., vn−1 of vectors in V
that are linearly independent and span V. Consequently, every v
vector in V can be uniquely written as
v = a0v0 + a1v1 + ... + an−1vn−1, where a0, ..., an−1 are elements of
the base field.
F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 3
Faculty of Electrical Engineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit
How do basis vectors vary in different forms and why
is that important?
Each basis vector represents a significant attribute. When the vector
v is composed of different basis vectors, the coefficient ai indicates
how much of the basis vector vi contributes to the vector v.
Each Transform like DFT, DCT, DWT and ... define their basis vectors
with different attributes for different applications.
1-D DFT
X(k) =
N−1
X
n=0
x(n)e−j 2π
N
kn
; x(n) =
N−1
X
k=0
X(k)ej 2π
N
kn
Indeed
ak = X(k) and vk = [ej 2π
N
0k
, ej 2π
N
1k
, ej 2π
N
2k
, · · · , ej 2π
N
k(N−1)
]
is related to frequency ωk = 2π
N k k = 0, 1, ..., N − 1
Therefore, The amount of frequency ωk present in the signal x is
given by the expression X(k).
F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 4
Faculty of Electrical Engineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit
DFT Basis Vectors
Only real section of vectors
are presented.
K = 0 is related to lowest
frequency and k = 4 is
related to the highest
frequency, and
X(k) = X(N − k)∗. So, it
requires to compute only
N/2 coefficients which are
complex numbers.
F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 5
Faculty of Electrical Engineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit
2-D Transforms for Images
F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 6
Faculty of Electrical Engineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit
2-D Transforms for Images: continued
Image Representation
Each image can be represented as the linear combination of different
orthonormal basis images that have the same size as the original
one. These basis images have special properties. To find how much
the original image overlaps with each basis image, it should be
calculated by projection the original image onto basis images by inner
product.
From now on, for simplicity, in the formulas, the size of images is considered
as M × N with the assumption that M = N.
F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 7
Faculty of Electrical Engineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit
Discrete Fourier Transform: DFT
DFT formulas:
There are N2 basis images in size N × N.
F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 8
Faculty of Electrical Engineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit
8 × 8 Basis Images
Symmetric Property: F(k1, k2) = F∗(N − k1, N − k2)
because of periodicity: F(k1, k2) = F∗(−k1, −k2)
Is there a problem with DFT?
F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 9
Faculty of Electrical Engineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit
FFTSHIFT Presentation
We normally use fftshift command in Matlab so that the low frequency
part of the image will be in the center.
F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 10
Faculty of Electrical Engineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit
Examples:
F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 11
Faculty of Electrical Engineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit
Examples:
F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 12
Faculty of Electrical Engineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit
Importance of DFT-Phase in Image Reconstruction
F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 13
Faculty of Electrical Engineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit
Properties of Fourier Transform
F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 14
Faculty of Electrical Engineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit
Properties of Fourier Transform
F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 15
Faculty of Electrical Engineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit
Filtering: Convolution
Consider: h=Impulse response of filter , kernel, Point Spread
Function (PSF); f=image
2D Convolution: g(m, n) =
P
k,l f(k, l).h(m − k, n − l)
operation extend size g larger than f.
In Matlab using g = conv2(f, h,′ same′) to preserve original image
size.
2D Filtering: g = filter2(h, f) that means:
g(m, n) =
P
k,l f(k, l).h(m + k, n + l)
In case of symmetric filter, ”filter2” and conv2” are the same.
F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 16
Faculty of Electrical Engineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit
Example:
There are two equivalent ways of carrying out linear spatial filtering
operations:
1. Spatial domain: convolution with a spatial operator;
2. Frequency domain: multiply FT of signal and filter, and compute
inverse FT of product.
F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 17
Faculty of Electrical Engineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit
Application: find an object in image;
Finding Letter T in the image.
F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 18

2-D DFT in images.pdf

  • 1.
    Faculty of ElectricalEngineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit DIGITAL IMAGE PROCESSING (DIP) Farah Torkamani Azar Faculty of Electrical Enginerring(Velenjak) Shahid Beheshti University f-torkamani@sbu.ac.ir, farahtorkamaniazar@gmail.com Section 3: 1-Image Transforms (DFT) Fall 1402 Fall 2023 F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 1
  • 2.
    Faculty of ElectricalEngineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit Outlier In all parts, we will use the definitions in MATLAB. Students can also use Python software. Discrete Fourier Transform (DFT) Discrete Cosine Transform (DCT) Walsh-Hadamard Transform Wavelet Transform Hotelling Transform Radon Transform F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 2
  • 3.
    Faculty of ElectricalEngineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit 1-D Transform Basis: Basis Vectors Simple Cartesian Basis Vectors      a0 a1 . . . an−1      = a0      1 0 . . . 0      + a1      0 1 . . . 0      + · · · + an−1      0 0 . . . 1      = n−1 X i=0 ai.vi, requires vT i .vj = δ(i − j) A vector space V is defined as a subset v0, ..., vn−1 of vectors in V that are linearly independent and span V. Consequently, every v vector in V can be uniquely written as v = a0v0 + a1v1 + ... + an−1vn−1, where a0, ..., an−1 are elements of the base field. F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 3
  • 4.
    Faculty of ElectricalEngineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit How do basis vectors vary in different forms and why is that important? Each basis vector represents a significant attribute. When the vector v is composed of different basis vectors, the coefficient ai indicates how much of the basis vector vi contributes to the vector v. Each Transform like DFT, DCT, DWT and ... define their basis vectors with different attributes for different applications. 1-D DFT X(k) = N−1 X n=0 x(n)e−j 2π N kn ; x(n) = N−1 X k=0 X(k)ej 2π N kn Indeed ak = X(k) and vk = [ej 2π N 0k , ej 2π N 1k , ej 2π N 2k , · · · , ej 2π N k(N−1) ] is related to frequency ωk = 2π N k k = 0, 1, ..., N − 1 Therefore, The amount of frequency ωk present in the signal x is given by the expression X(k). F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 4
  • 5.
    Faculty of ElectricalEngineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit DFT Basis Vectors Only real section of vectors are presented. K = 0 is related to lowest frequency and k = 4 is related to the highest frequency, and X(k) = X(N − k)∗. So, it requires to compute only N/2 coefficients which are complex numbers. F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 5
  • 6.
    Faculty of ElectricalEngineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit 2-D Transforms for Images F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 6
  • 7.
    Faculty of ElectricalEngineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit 2-D Transforms for Images: continued Image Representation Each image can be represented as the linear combination of different orthonormal basis images that have the same size as the original one. These basis images have special properties. To find how much the original image overlaps with each basis image, it should be calculated by projection the original image onto basis images by inner product. From now on, for simplicity, in the formulas, the size of images is considered as M × N with the assumption that M = N. F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 7
  • 8.
    Faculty of ElectricalEngineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit Discrete Fourier Transform: DFT DFT formulas: There are N2 basis images in size N × N. F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 8
  • 9.
    Faculty of ElectricalEngineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit 8 × 8 Basis Images Symmetric Property: F(k1, k2) = F∗(N − k1, N − k2) because of periodicity: F(k1, k2) = F∗(−k1, −k2) Is there a problem with DFT? F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 9
  • 10.
    Faculty of ElectricalEngineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit FFTSHIFT Presentation We normally use fftshift command in Matlab so that the low frequency part of the image will be in the center. F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 10
  • 11.
    Faculty of ElectricalEngineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit Examples: F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 11
  • 12.
    Faculty of ElectricalEngineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit Examples: F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 12
  • 13.
    Faculty of ElectricalEngineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit Importance of DFT-Phase in Image Reconstruction F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 13
  • 14.
    Faculty of ElectricalEngineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit Properties of Fourier Transform F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 14
  • 15.
    Faculty of ElectricalEngineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit Properties of Fourier Transform F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 15
  • 16.
    Faculty of ElectricalEngineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit Filtering: Convolution Consider: h=Impulse response of filter , kernel, Point Spread Function (PSF); f=image 2D Convolution: g(m, n) = P k,l f(k, l).h(m − k, n − l) operation extend size g larger than f. In Matlab using g = conv2(f, h,′ same′) to preserve original image size. 2D Filtering: g = filter2(h, f) that means: g(m, n) = P k,l f(k, l).h(m + k, n + l) In case of symmetric filter, ”filter2” and conv2” are the same. F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 16
  • 17.
    Faculty of ElectricalEngineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit Example: There are two equivalent ways of carrying out linear spatial filtering operations: 1. Spatial domain: convolution with a spatial operator; 2. Frequency domain: multiply FT of signal and filter, and compute inverse FT of product. F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 17
  • 18.
    Faculty of ElectricalEngineering Digital Image Processing, Sec. (3-1-Image Transforms (DFT)) Shahid Beheshti Universit Application: find an object in image; Finding Letter T in the image. F. Torkamani Azar, https://facultymembers.sbu.ac.ir/torkamaniazar/course/digital-image-processing-fall-2023/ 18