---
# System prepended metadata

title: DIP Lab 4
tags: [DIP]

---

---
title: DIP Lab 4
tags: DIP
---
# DIP Lab 4
105042015 沈冠妤 外語20

### 1. Proj05-01 – Noise Generators (20%)

* **Explanation:**

    (a) Implement a Gaussian noise to an image.  You must be able to specify the noise mean and variance.
    (b) Implement salt-and-pepper noise to an image. You must be able to specify the probabilities of both salt and pepper.


* **Result:**
<img src="https://i.imgur.com/IRaaqak.png" height="50%" width="50%"/>
<img src="https://i.imgur.com/c9G9RsO.png" height="50%" width="50%"/>
(above: Gaussian noise, mean=0.2, variance=0.01)
<img src="https://i.imgur.com/miqtnCC.png" height="50%" width="50%"/>
(above: Salt&Pepper noise, ps=0.3, pp=0.1)  

---

### 2. Proj05-03 – Periodic Noise Reduction Using a Notch Filter (40%)

* **Explanation:**

    (a) Implement sinusoidal noise.
    (b) Add sinusoidal noise to image.
    (c) Display the spectrum of the image.
    (d) Notch-filter the image.

* **Result:**

<img src="https://i.imgur.com/mHLedgp.png" height="50%" width="50%"/>
<img src="https://i.imgur.com/ZcJMbyQ.png" height="50%" width="50%"/>
<img src="https://i.imgur.com/i9LvpsL.png" height="50%" width="50%"/>
<img src="https://i.imgur.com/F7Boalz.png" height="50%" width="50%"/>
<img src="https://i.imgur.com/qN1DIt3.png" height="50%" width="50%"/>
<img src="https://i.imgur.com/jDIDve6.png" height="50%" width="50%"/>

---

### 3. Proj05-04 – Parametric Wiener Filter (40%)

* **Explanation:**

    (a) Implement a linear motion blurring filter.
    (b) Blur image using a=0.1, b=0.1, T=1.
    (c) Add Gaussian noise of 0 mean and variance of 10 pixels to the blurred image.
    (d) Restore the image using the Wiener filter.

* **Result:**

<img src="https://i.imgur.com/hsetV0y.png" height="50%" width="50%"/>
<img src="https://i.imgur.com/CNjPAqx.png" height="50%" width="50%"/>
<img src="https://i.imgur.com/eP0USjK.png" height="50%" width="50%"/>
<img src="https://i.imgur.com/0r0QDnb.png" height="50%" width="50%"/>
<img src="https://i.imgur.com/oRli2Dn.pngg" height="50%" width="50%"/>
<img src="https://i.imgur.com/D9tRBV1.png" height="50%" width="50%"/>

<img src="https://i.imgur.com/dQsUFR9.png" height="60%" width="60%"/>

(above: spectrum of linear motion blur filter)


* **Comparison:**

    In Weiner filter debluring, k=0.01 has the best deblur result among k=[0.00025, 0.001, 0.01]. Since:
    
    noise_var / var(img(:)) = 0.0098
    
    k=0.01 is the closest to 0.0098, hence k=0.01 has the best result.


