Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Image Reconstruction Using Fast Inverse Fourier

Transform (IFFT)

AHMAD FARIS BIN HAJI MOHD HASNAN


Faculty of Electrical Engineering
Universiti Teknologi MARA Malaysia
40450 Shah Alam, Selangor, Malaysia
farishjhasnan@gmail.com

Abstract—This paper present the image reconstruction using Fast sine and cosine components [2]. The output of the
Fourier Transform (FFT) and Inverse Fast Fourier Transform transformation represents the image in the Fourier or frequency
(IFFT) technique. Two types of image are considered which are domain, while the input image is the spatial domain equivalent
gray scales and binary images. The original images are being [3]. Fourier analysis can be used to remove noise from a signal
reference when reconstructing the original image and image with or image. Interpretation of the complex Fourier Transform is
noise. The original images will be injected with Gaussian, not always straightforward. Convolution and deconvolution are
random and salt & pepper noises using MATLAB toolbox. The “simple” in Fourier transform space to restore or enhance
mean square error will be calculated includes the peak signal to
images. Comparison between DFT and FFT Computation
noise ratio (PSNR) for each type of images. Then, the PSNR for
Speeds is made by Parul Goyal. From results it is evident that
each type of images will be observed in terms of the effectiveness
of IFFT as a reconstruction algorithm. The image reconstruction
for a couple of samples of various lengths the time taken by
results have shown that the grayscale image has the slightly normal DFT is higher than the time taken by FFT. Thus the
better quality compared to binary image when noiseless image speed of FFT is beneficial when large calculations are required
being reconstructed using FFT. [6].
In this paper the grayscale and binary images is perturbed
Keywords-componen ; FFT, IFFT, DFT, PSNR, Gaussian
with three types of noise: Gaussian, random, salt & pepper.
noise, random noise, salt & pepper noise
The PNSR of the images is calculated from the mean square
I. INTRODUCTION error (MSE) for binary (30x30) and grayscale (64x64) images
respectively.
Digital image can be interpreted as a representation of a
two-dimensional image using ones and zeros (binary) and it is The rest of this paper is organized as follows: Section II &
depends on whether or not the image resolution is fixed. In III present a mathematical background of Fourier transform
photography and computing, a grayscale digital image is an and the reconstruction algorithm, and mathematical
image in which the value of each pixel is a single sample, that background of error computation respectively. In section IV,
is, it carries only intensity information. Images of this sort, also the results are presented. Finally, the recommendation and
known as black-and-white, are composed exclusively of shades conclusion being illustrated in section V.
of gray, varying from black at the weakest intensity to white at
the strongest.[1] .The pixel values of this image runs from 0 to
255. A binary image is a digital image that has only two II. FAST FOURIER TRANSFORM
possible values for each pixel. [1] Typically the two colours
used for a binary image are black and white though any two FFTs were first discussed by Cooley and Tukey (1965),
colours can be used [1]. The colour used for the object(s) in the although Gauss had actually described the critical factorization
image is the foreground colour while the rest of the image is step as early as 1805 (Bergland 1969, Strang 1993)[4].Fast
the background colour [1]. Binary images are also called bi- Fourier Transform (FFT) is an efficient implementation of
level or two-level. This means that each pixel is stored as a Discrete Fourier Transform (DFT) and is used, apart from other
single bit (0 or 1). fields, in digital image processing. Fast Fourier Transform is
applied to convert an image from the image (spatial) domain to
For this project, it’s describe about reconstruction of image the frequency domain.  If the input signal is an image then the
which means, the attempts to retrieve the lost and obscured number of frequencies in the frequency domain is equal to the
from imaging process itself. It is also can be interpreted as the number of pixels in the image or spatial domain. The inverse
problem of estimating a function from its Fourier-transform transform re-transforms the frequencies to the image in the
values. The Fourier Transform is an important image spatial domain.
processing tool which is used to decompose an image into its

1
The basis function of fourier transform is represent by N −1
( − j 2Nπ nk )
following equation: X ( k )= ∑ x ( n ) e
n=0

N
X ( k )=∑ x ( j ) ω−N jk (1)
N
−1 − j2 π ( 2 n ) k
2
j=0
¿∑ x ( 2 n) e
( N )
n=0

and its inverse equation,


N
−1 − j 2 π (2n +1)k
2
N
+∑ x ( 2 n+1 ) e
( N )
(6)
x ( j)=∑ x ( k ) ω Njk (2) n=0
j=0

where,
N − j 2 π nk
ω N =e ¿ ¿ 2
−1
even
¿ ∑ x ( n) e
( N
2 )
¿ cos ( 2Nπn )− jsin( 2Nπn ) (3)
n=0

N − j 2 π nk

+e
¿
2
−1

∑ x ( n )odd e
( N
2 )¿ (7)
The DFT a 2D image is given by the following equation : n=0

M −1 N−1 ux vy
− j2π( + )
M N
F (u , v)= ∑ ∑ f ( x , y )e (4) x(n) is segmented into its even and odd indexed elements.
x=0 y=0

Where f(x,y) is the image in the spatial domain and the III. ERROR
exponential term is the basis function corresponding to each
point F(u,v) in the Fourier space. The equation can be Error is expressed in terms of Peak Signal to Noise Ratio
interpreted as: the value of each point F(u,v) is obtained by (PSNR). The PSNR is the ratio between a signal's maximum
multiplying the spatial image with the corresponding base power and the power of the signal's noise. Engineers
function and summing the result. commonly use the PSNR to measure the quality of
reconstructed images that have been compressed. Each picture
The inverse DFT a 2D image is given by the following element (pixel) has a colour value that can change when an
equation: image is compressed and then uncompressed. Signals can have
a wide dynamic range, so PSNR is usually expressed in
M −1 N −1 ux vy
decibels, which is a logarithmic scale,
1 j 2π( + )
M N
f (x , y )= ∑ ∑ f (u , v)e (5)
MN 2 n−1
u =0 v=0
PSNR=10 log 10 ( MS error ) (8)

The values F(u,v) are the DFT coefficients of f(x,y). The


zero-frequency coefficient, F(0,0), is often called the "DC N= number of bits that represent the pixels
component." DC is an electrical engineering term that stands Since image used is double precision, n= 1
for direct current. (Note that matrix indices in MATLAB
always start at 1 rather than 0; therefore, the matrix 1
elements f(1,1) and F(1,1) correspond to the mathematical
quantities f(0,0) and F(0,0), respectively[5].
PSNR=10 log 10 ( MS error ) (9)

FFT implement DFT faster than DFT itself by evolving the


Where MSerror is defined as,
basis function of DFT into MATLAB RADIX-2 FFT
ALGORITHM: M−1 N −1
1 2
MS error =
M ×N
∑ ∑ ( ^f ( i , j )−f (i , j)) (10)
i=0 j=0

2
Where, ^f ( i , j ) is the estimated image, f (i, j) is the actual TABLE 3: 4X4 SAMPLE VALUES OF I FFT IMAGE (BINARY)
image and MxN is the image size.
-1.02E- -7.34E-
The error is computed for each pixel location and sum up to
8.14E-18 3.07E-18 16 17
obtain the error for each noiseless images and noisy images. A
graph of error versus type of noise is plotted for each noise 5.76E-17 7.45E-17 2.28E-17 2.22E-17
and analyze for the trend of errors as noise level increase. -2.97E- -6.66E- -9.37E- -2.54E-
17 17 17 17
-3.07E- -6.23E- -9.03E- -1.07E-
IV. EXPERIMENTAL STUDIES AND DISCUSSION
17 17 17 16
In the experimental studies, FFT is used to extract the
features of image and IFFT is used for the analytical
reconstruction of noiseless image and image with noise. The
binary and grayscale images are perturbed with Gaussian, For grayscale image, 4x4 pixel sample values of original,
random and salt & pepper noise. 4x4 frequency samples values of FFT and 4x4 pixel sample
The 4x4 pixel sample values of original, 4x4 frequency values of IFFT are shown in Tables 4, 5 and 6 respectively.
samples values of FFT and 4x4 pixel sample values of IFFT for
binary image are shown in Tables 1, 2 and 3 respectively.
TABLE 4: 4X4 SAMPLE VALUES OF ORIGINAL IMAGE (GRAYSCALE)

TABLE 1: 4X4 SAMPLE VALUES OF ORIGINAL IMAGE (BINARY) 0.32941 0.33333 0.29019 0.29803
2 3 6 9
0 0 0 0 0.32156 0.29411 0.31764 0.32941
0 0 0 0 9 8 7 2
0 0 0 0
0.58823 0.56862 0.58431 0.61960
5 7 4 8
0 0 0 0 0.60392 0.62745 0.63137 0.65882
2 1 3 4

TABLE 2: 4X4 FREQUENCY SAMPLE VALUES OF FFT IMAGE (BINARY)

- -
308.0000 91.62774384 140.3181442 59.232002 TABLE 5: 4X4 FREQUENCY SAMPLE VALUES OF FFT IMAGE (GRAYSCALE)
00000000 + 44960 + 66995 + 6681219 - -
0.000000000 9.630463945 29.82554228 19.245644314
00000i 89505i 53106i 1929i 1676.2666 11.990051 97.905994 20.834730
6666667 + 3070206 - 0299281 - 2917860 +
- - 0.0000000 2.0998440 6.2587312 101.40918
103.8418119 14.64110 78.48655 26.189799736 0000000i 0152341i 7576923i 9176990i
32312 - 14237231 - 80073187 + 3185 +
-
9.719979365 31.65515554 36.73404329 0.9510565162
32675i 03564i 80328i 95151i 7.2667717 165.07218 133.11871 31.745439
2117311 - 8215162 - 4706746 - 8572300 -
- - 72.983290 83.727780 78.951743 108.26730
68.03463154 39.65799 8.110477 13.210271962 0188870i 9608719i 8858486i 0308648i
04774 - 20753268 - 03203802 + 2424 -
- -
22.64617047 3.162714649 20.46246644 5.1926815974
16173i 68597i 17671i 2370i 73.605541 43.192215 42.857694 27.235283
5380781 - 6115470 + 6514981 + 0995915 -
- - 18.441824 55.676646 21.774043 35.483412
14.47213595 8.997601 4.078897585 1.1180339 4911957i 8993672i 7496981i 4134557i
49996 - 69498641 + 64552 - 8874989 -
64.838928 44.320373 - 5.4438674
13.20879010 21.34202045 19.43546555 0.8122992405
18602i 18187i 15210i 82267i 8851013 + 4089228 - 24.616378 9827855 +
28.215379 21.247531 0433274 + 21.877303
2338999i 8450391i 36.038284 3784998i

3
8145409i 0.1 1

(b)
TABLE 6: 4X4 SAMPLE VALUES OF I FFT IMAGE (GRAYSCALE)
Figure 1: Reconstruction of the (a) grayscale image (b) binary
image increasing Gaussian noise (variance).
0.32941 0.33333 0.29019 0.29803
2 3 6 9
0.32156 0.29411 0.31764 0.32941
9 8 7 2
0.58823 0.56862 0.58431 0.61960
5 7 4 8
0.60392 0.62745 0.63137 0.65882
2 1 3 4

From the tables, it is observed that the FFT compute the


pixels values into complex values. After that, the complex
values are being computed into real values by IFFT. These
show that fourier transform decompose the image properties
into its sine and cosine components.

Figures 1, 2, and 3 shows the results of reconstructed image


with increasing noise level.

0 0.01

0
0.01

0.1
1 0.1 1
(a)
(a)

0 0.01
0 0.01

4
0.1 1
0.1 1
(b)

(b)
Figure 3: Reconstruction of the (a) grayscale image (b) binary
image with increasing salt & pepper noise (density).
Figure 2: Reconstruction of the (a) grayscale image (b) binary
image with increasing random noise (variance).

Their reconstruction errors in terms of Power Signal to


Noise Ratio are tabulated in Tables 7, 8 and 9 respectively.
TABLE 7: PSNR WITH INCREASING GAUSSIAN NOISE

0 0.01

0.1 1

(a)

TABLE 8: PSNR WITH INCREASING RANDOM NOISE

0 0.01

5
Figure 4: PSNR with increasing Gaussian noise level

TABLE 9: PSNR WITH INCREASING SALT & PEPPER NOISE

Figure 5: PSNR with increasing random noise level

From Table 7, 8 and 9 it is observed that PSNR of


grayscale image slightly dominates rather than binary image.
The PSNR of the grayscale image is higher than PSNR of
grayscale image for salt & pepper noise and at variance higher
than 0.5 for Gaussian noise. Different result shown for random
noise where PSNR value of binary image slightly higher
compared to grayscale image all types of noise when the noise
level ranging from 0.1 to 1. The higher PSNR is better because
it show that the signal or pixels values (image processing) are
higher than noise values after the reconstruction process. The
performance of IFFT is better and less sensitivity to noise when
use binary image. A similar performance can also been seen in
Fig.4, Fig. 5 and Fig. 6 when the graph of PSNR versus noise Figure 6: PSNR with increasing salt & pepper noise
level of the reconstructed image were plotted.
These three figures show that both images have slightly
similar performance. In image processing, PSNR value must be

6
greater than about 20dB to be considered a high quality picture Figure 8: PSNR of reconstructed grayscale image
[7].

TABLE 10: PSNR VALUE OF NOISELESS AND MINIMUM NOISE LEVEL OF


NOISY IMAGE Figures 7 and 8 show the graph of binary and grayscale
images based on minimum PSNR values of reconstructed
noiseless (as reference) and noisy images with three different
noise using FFT and IFFT for binary and grayscale image
respectively. Figure 7 show that the noisy image with
Gaussian noise has the nearest PSNR values to the noiseless
image and similar result for the grayscale image in Figure 8.

V. CONCLUSION
Table 10 shows the PSNR values for reconstructed images The image reconstruction results have shown that the
of noiseless (original) and noisy image at minimum level of grayscale image has the slightly better quality compared to
noise. For Gaussian and random noise, the minimum level is at binary image when noiseless image being reconstructed using
σ2 = 0.01, and for salt & pepper noise is at d = 0.01. FFT. Experimental results also show grayscale image is
slightly less sensitivity to noise rather than binary image when
reconstructed the image perturbed with Gaussian (at σ2>0.5)
and salt & pepper noise using the FFT algorithm but binary
image is slightly better when images perturbed with random
noise. The error occurs because some data will lose during the
transformation process.
In image processing field, there are various way to treat
image and preserved the originality of the image properties.
Post-processing is the common technique such as filtering
process, convolution process, masking process and etc.
Fourier transform offer various application for pre-processing
and post processing.

REFERENCES

[1] H. M. Shieh ; C. L. Byrne ; , “Image reconstruction from limited Fourier


Figure 7: PNSR of reconstructed binary image data,” J. Opt. Soc. Am. A/Vol. 23, No. 11/November 2006
[2] R. Gonzales; R. Woods;,” Digital Image Processing”, Addison-Wesley
Publishing Company, 1992, pp 81 - 125

‘ [3] Ballard; C. Brown; , “Computer Vision”, Prentice-Hall, 1982, pp 24 -


30.
[4] M. T. Heideman, D. H. Johnson, and C. S. Burrus, "Gauss and the
history of the FFT," IEEE Acoustics, Speech, and Signal
Processing Magazine, vol. 1, pp. 14-21, October 1984. also in IEEE
Press FFT Reprints, by P. Duhamel, 1995.
[5] “Inverse Fourier Transform”, retrieve from
http://www.mathworks.com/help/techdoc/math/brentm1-1.html#brentpw
[6] Parul Goyal ; , “Generation of 1D and 2D FFT function in MATLAB”,
December 2010
[7] Don H. Johnson (2006) Signal-to-noise ratio. Scholarpedia, 1(12):2088,
revision #40247

7
8

You might also like