Dr. Cho’s Website
Course Materials

# Frequency-domain filtering

Institute for Environmental and Spatial Analysis...University of North Georgia

## 1   Exercise: Fourier transform

Solve this Fourier transform problem using Excel. We will create a spreadsheet to calculate each term in the DFT and inverse DFT equations. That is, $f(x)e^{-2i\pi ux/M}$ and $F(u)e^{2i\pi ux/M}$.

### 1.1   Complex numbers in Excel

• COMPLEX(a, b): $a+ib$
• IMREAL(COMPLEX(a, b)): $a$
• IMAGINARY(COMPLEX(a, b)): $b$
• IMEXP(COMPLEX(a, b)): $e^{a+ib}$
• IMEXP(COMPLEX(0, -2*PI())): $e^{-2\pi}$
• IMPRODUCT(c, IMEXP(COMPLEX(a, b))): $ce^{a+ib}$
• IMSUM(...): $\sum\cdots$

### 1.2   State the problem

First, copy the problem. What is $M$?

x f(x) M 0 1 2 5 3 2 ?

### 1.3   $f(x)e^{-2i\pi ux/M}$

$F(u)=\frac{1}{M}\sum_{x=0}^{M-1}f(x)e^{-2i\pi ux/M}$

For each $u=0,\cdots,M-1$, we need $x=0,\cdots,M-1$.

uxf(x)f(x)*exp()
005=IMPRODUCT($f(x)$, IMEXP(COMPLEX(0, -2*PI()*$u$*$x$/$M$)))
013
022
105
113
122
205
213
222

### 1.4   $F(u)$

Now, for each $u$, we need to sum $f(x)e^{-2i\pi ux/M}$ and divide it by $M$ to get $F(u)$.

uxf(x)f(x)*exp()F(u)
005=IMPRODUCT(IMSUM($f(x)e^{-2i\pi ux/M}$), 1/$M$)
013
022
105=IMPRODUCT(IMSUM($f(x)e^{-2i\pi ux/M}$), 1/$M$)
113
122
205=IMPRODUCT(IMSUM($f(x)e^{-2i\pi ux/M}$), 1/$M$)
213
222

### 1.5   $F(u)e^{2i\pi ux/M}$

$f(x)=\sum_{u=0}^{M-1}F(u)e^{2i\pi ux/M}$

For each $x=0,\cdots,M-1$, we need $u=0,\cdots,M-1$.

xuF(u)F(u)*exp()
00=IMPRODUCT($F(u)$, IMEXP(COMPLEX(0, 2*PI()*$u$*$x$/$M$)))
01
02
10
11
12
20
21
22

### 1.6   $f(x)$

For each $x$, we need to sum $F(u)e^{2i\pi ux/M}$ and take its real part to get $f(x)$.

xuF(u)F(u)*exp()F(u)
00=IMREAL(IMSUM($F(u)e^{-2i\pi ux/M}$))
01
02
10=IMREAL(IMSUM($F(u)e^{-2i\pi ux/M}$))
11
12
20=IMREAL(IMSUM($F(u)e^{-2i\pi ux/M}$))
21
22

## 2   Exercise: Ideal low-pass filter

$H(u,v)= \begin{cases} 1& \text{if }D(u,v)\leq D_0\\ 0& \text{otherwise} \end{cases}$

Fig0429(a)(blown_ic).tif

dippy.py

frequency_filter_exercise.py

filt = ideal_lowpass_filter

This filter smooths the image, but it has a ringing effect because of a sudden drop in the filter surface.

## 3   Exercise: Gaussian low-pass filter

$H(u,v)=e^{-D^2(u,v)/(2D_0^2)}$

filt = gaussian_lowpass_filter

This filter also smooths the image, but it does not have the same ringing effect by the ideal low-pass filter because it has a smooth drop in the filter surface.

## 4   Exercise: Gaussian high-pass filter

$H(u,v)=1-e^{-D^2(u,v)/(2D_0^2)}$

filt = gaussian_highpass_filter

This filter highlights transitions between smooth areas, which in effect, sharpens the image.

## 5   Homework: Fourier transform

Solve this Fourier transform problem using Excel. Please submit your Excel file and the final answer in the table below (only real parts).