---
title: DIP Lab 3
tags: DIP
---
# DIP Lab 3
105042015 沈冠妤 外語20
### 1. Proj.04-01 Two-Dimensional Fast Fourier Transform (40%)
* **Explanation:**
Do 2D-FFT manually, and repeat the process in p.38 of handout.
<img src="https://i.imgur.com/HkjZsx0.png" height="70%" width="70%"/>
* **Result:**
<img src="https://i.imgur.com/V8RNGKu.png" height="70%" width="70%"/>
<img src="https://i.imgur.com/jV7cXqW.png" height="70%" width="70%"/>
<img src="https://i.imgur.com/ezm5tNZ.png" height="70%" width="70%"/>
<img src="https://i.imgur.com/n9RNKBT.png" height="70%" width="70%"/>
(Above: zoom in of noised image)
<img src="https://i.imgur.com/QBluMLc.png" height="70%" width="70%"/>
<img src="https://i.imgur.com/oKWAoEM.png" height="70%" width="70%"/>
<img src="https://i.imgur.com/TpD1cgX.png" height="70%" width="70%"/>
<img src="https://i.imgur.com/O1bpF4a.png" height="70%" width="70%"/>
<img src="https://i.imgur.com/2EL8Mak.png" height="70%" width="70%"/>
* **Discussion:**
First, implement 1D-FFT:
* Split the input vector into two, one contains odd elements of the input vector, and the other contains even elements of the input vector.
* Do DFT according to given equation to the two vectors:
<img src="https://i.imgur.com/lnO7dtz.png" height="" width="60%"/>
* Bind the two vectors. First half of the result(i): even_vector(i) + odd_vector(i) * exp(-(1j*2*pi)/N); Second half of the result: even_vector(i-N/2) + odd_vector(i-N/2) * exp(-(1j*2*pi)/N)
Then, implement 2D-FFT:
* Split the 2D input image into two 1D-FFT.
---
### 2. Proj.04-02 - Fourier Spectrum and Average Value (20%)
* **Explanation:**
Compute a given image's centered fourier spectrum, and calculate its average value. Compare it with the average value of the original image in spatial domain.
* **Result:**
<img src="https://i.imgur.com/oCV99mq.png" height="50%" width="50%"/>
<img src="https://i.imgur.com/ujmpgVH.png" height="50%" width="50%"/>
* **Comparison:**
Center frequency component is 207.3147, and the mean of spatial domain is also 207.3147.
One of the properties of 2D-DFT includes:

Since the center point of spectrum indicates the lowest frequency, which will be the average of the pixels in spatial domain. Higher frequency means above or below average.
---
### 3. Proj.04-03 Lowpass Filtering (20%)
* **Explanation:**
Implement the Gaussian lowpass filter, I/O as H = LowPassFilter(M, N, D0). M and N indicates the size of the filter, D0 as cut off frequency.
* **Result:**

* **Comparison:**
Image becomes more blurred as the cut off frequency becomes lower, because the highter frequencies are filtered out.
---
### 4. Proj.04-04 Highpass Filtering (20%)
* **Explanation:**
Implement the Gaussian highpass filter. Basically it is the same program as Gaussian lowpass filter mentioned above.
<img src="https://i.imgur.com/5TXc8tv.png" height="" width="50%"/>
* **Result:**
