Problems with Matlab Projects? You may face many Problems, but do not worry we are ready to solve your Problems. All you need to do is just leave your Comments. We will assure you that you will find a solution to your project along with future tips. On Request we will Mail you Matlab Codes for Registered Members of this site only, at free service...Follow Me.

2D DFT

Summary: This module extends the ideas of the Discrete Fourier Transform (DFT) into two-dimensions, which is necessary for any image processing.





2D DFT

To perform image restoration (and many other useful image processing algorithms) in a computer, we need a Fourier Transform (FT) that is discrete and two-dimensional.
F[k,l]=F(u,v)|u=
2πk
N
 
,v=
2πl
N
(1)
for k={0,,N1} and l={0,,N1}.
F(u,v)=((f[m,n](um)(vm)))(2)
F[k,l]=
N1
m=0
 (
N1
n=0
 (f[m,n]()
2πkm
N
 
()
2πln
N
 
)
)
(3)
where the above equation (Equation 3) has finite support for an NxN image.

Inverse 2D DFT

As with our regular fourier transforms, the 2D DFT also has an inverse transform that allows us to reconstruct an image as a weighted combination of complex sinusoidal basis functions.
f[m,n]=
1
N2
 
N1
k=0
 (
N1
l=0
 (F[k,l]
2πkm
N
 
2πln
N
 
)
)
(4)

EXAMPLE 1: Periodic Extensions

Figure 1: Illustrate the periodic extension of images.
Figure 1 (per_ext.png)

2D DFT and Convolution

The regular 2D convolution equation is
g[m,n]=
N1
k=0
 (
N1
l=0
 (f[k,l]h[mk,nl])
)
(5)

EXAMPLE 2

Below we go through the steps of convolving two two-dimensional arrays. You can think of f as representing an image and h represents a PSF, where h[m,n]=0 formn>1 and mn<0h=(
h[0,0]h[0,1]
h[1,0]h[1,1]
) f=(
f[0,0]f[0,N1]
f[N1,0]f[N1,N1]
)
 Step 1 (Flip h):
h[m,n]=(
h[1,1]h[1,0]0
h[0,1]h[0,0]0
000
)
(6)
Step 2 (Convolve):
g[0,0]=h[0,0]f[0,0](7)
We use the standard 2D convolution equation (Equation 5) to find the first element of our convolved image. In order to better understand what is happening, we can think of this visually. The basic idea is to take h[m,n] and place it "on top" of f[k,l], so that just the bottom-right element, h[0,0] of h[m,n] overlaps with the top-left element, f[0,0], of f[k,l]. Then, to get the next element of our convolved image, we slide the flipped matrix, h[m,n], over one element to the right and get the following result: g[0,1]=h[0,0]f[0,1]+h[0,1]f[0,0] We continue in this fashion to find all of the elements of our convolved image, g[m,n]. Using the above method we define the general formula to find a particular element of g[m,n] as:
g[m,n]=h[0,0]f[m,n]+h[0,1]f[m,n1]+h[1,0]f[m1,n]+h[1,1]f[m1,n1](8)

Circular Convolution

EXERCISE 1

What does H[k,l]F[k,l] produce?
Due to periodic extension by DFT (Figure 2):
Figure 2
Figure 2 (dft_extension.png)
Based on the above solution, we will let
g[m,n]=IDFT(H[k,l]F[k,l])(10)
Using this equation, we can calculate the value for each position on our final image, g[m,n]. For example, due to the periodic extension of the images, when circular convolution is applied we will observe a wrap-around effect.
g[0,0]=h[0,0]f[0,0]+h[1,0]f[N1,0]+h[0,1]f[0,N1]+h[1,1]f[N1,N1](11)
Where the last three terms in Equation 11 are a result of the wrap-around effect caused by the presence of the images copies located all around it.

Zero Padding

If the support of h is MxM and f is NxN, then we zero pad f and h to M+N1 x M+N1 (see Figure 3).
Figure 3
Figure 3 (zero_pad.png)

NOTE: 

Circular Convolution = Regular Convolution

Computing the 2D DFT

F[k,l]=
N1
m=0
 (
N1
n=0
 (f[m,n]()
2πkm
N
 
()
2πln
N
 
)
)
(12)
where in the above equation, 
N1
n=0
 (f[m,n]()
2πln
N
 
)
 is simply a 1D DFT over n. This means that we will take the 1D FFT of each row; if we have N rows, then it will requireNlogN operations per row. We can rewrite this as
F[k,l]=
N1
m=0
 (f[m,l]()
2πkm
N
 
)
(13)
where now we take the 1D FFT of each column, which means that if we have N columns, then it requires NlogN operations per column.

NOTE: 

Therefore the overall complexity of a 2D FFT is O(N2logN) where N2 equals the number of pixels in the image.

0 comments:

Post a Comment

Recent Comments

Popular Matlab Topics

Share your knowledge - help others

Crazy over Matlab Projects ? - Join Now - Follow Me

Sites U Missed to Visit ?

Related Posts Plugin for WordPress, Blogger...

Latest Articles

Special Search For Matlab Projects

MATLAB PROJECTS

counter

Bharadwaj. Powered by Blogger.