Image processing in the frequency domain Image processing in the

Image processing in the frequency domain
• The use of image transformation to the frequency domain
– The image filter design in the frequency domain and the
implementation of fast methods for image filtering
– Emphasize some features in the image invisible in the spatial
domain (e.g. areas that appear periodically as well as periodical
disturbances or noise)
– Pattern detection in the frequency domain
– Obtain more compact (memory efficient) methods of storing images
(used in image compression techniques, e.g. in JPEG, MJPEG,
MPEG, etc.)
1
Image processing in the frequency domain
• The Fourier transform (FT) of continuous function from the time domain
to the frequency
– FT
– Inverse FT
Euler’s formula:
• The Fourier transform (DFT) of discrete function
– DFT
– Inverse DFT
2
Image processing in the frequency domain
• The two-dimensional discrete Fourier transform (2-D DFT)
– 2-D DFT
• Magnitude spectrum of Fourier transform
• Phase spectrum of Fourier transform
– Inverse 2-D DFT
3
Image processing in the frequency domain
• Magnitude spectrum of the image
F=fft2(double(i));
F1=log(abs(F)+1);
F1=F1/max(max(F1));
imshow(F1)
figure;imshow(F1); colormap(jet); colorbar
v
u
4
Image processing in the frequency domain
F1=fftshift(log(abs(F)+1));
mesh(F1);
v
u
5
Image processing in the frequency domain
6
Image processing in the frequency domain
7
Image processing in the frequency domain
• The properties of the Fourier transform
– Symmetry
For real function Fourier transform is conjugate symmetric
* - indicates conjugate operation
on a complex number
Symmetry of magnitude spectrum
– Periodicity
For the transform
with size
is true that
It is assumed that the image is a periodic function with period
8
Image processing in the frequency domain
– Separability
2-D Fourier transform can be expressed in the separable form and
calculated using 1-D transformations. First, 1-D DFT can be calculated along
the rows and then for the result, along the columns of the image.
Transformation
of rows
Transformation
of columns
9
Image processing in the frequency domain
Transformation
of rows
Transformation
of columns
Transformation
of columns
Transformation
of rows
10
Image processing in the frequency domain
– Translation in frequency and spatial domain
For
Similarly
fftshift
11
Image processing in the frequency domain
– The average value of the image (DC component of the spectrum)
12
Image processing in the frequency domain
– Rotation in the spatial and frequency domain of angle
For the polar coordinates
13
Image processing in the frequency domain
• The Fourier transform of the product and convolution of 2-D function
– The second relationship is used in the filtering of images in the frequency
domain
• Filtering in the frequency domain
1. Compute the Fourier transform of the image
spectrum)
2. Multiply F-image
by a filter function
(centering of the
(array multiplication)
3. Compute the inverse transform of
(decentering of the spectrum and calculation of real part of the result)
14
Image processing in the frequency domain
• Ideal filters
– Lowpass filters
is the distance form point
to the center of F-image
- cutoff frequency
v
u
v
u
15
Image processing in the frequency domain
Image of ideal lowpass filter in frequency domain and corresponding spatial filter
x
v
y
u
x
16
Image processing in the frequency domain
17
Image processing in the frequency domain
– Ideal highpass filters
18
Image processing in the frequency domain
– Filtering of periodic disturbances
256x256
19
Image processing in the frequency domain
– Gaussian filter in the frequency domain
20
Image processing in the frequency domain
21
Image processing in the frequency domain
– Butterworth filters
22
Image processing in the frequency domain
23
Image processing in the frequency domain
• Pattern recognition in frequency domain using correlation
C = real(ifft2(fft2(bw).* fft2(rot90(a,2),256,256)));
figure, imshow(C,[])
mx=max(C(:));
thresh = mx-10;
figure, imshow(C > thresh)
Correlation
24
Cosine transform in image compression
• Cosine transform (DCT)
– DCT
– Inverse DCT
25
Cosine transform in image compression
figure, imshow(i)
c=dct2(i);
imshow(log(abs(c)),[]), colormap(jet), colorbar
c(abs(c)< 0.05) = 0;
j = idct2(c);
The number of image pixels: 65536
figure, imshow(j)
The number of coefficients reset to zero: 51079
26
Cosine transform in image compression
– Basis functions for DCT
– DCT matrix
• In Matlab dctmtx
• The matrix allows to determine the one-dimensional DCT in image
columns
• The two-dimensional DCT for image
27
Cosine transform in image compression
– Cosine transform in JPEG compression
Zigzag pattern is used in the
last step (entropy encoder)
28