Homework 8

Noise Removal

Description

    You can download lena.bmp here !
    You can also download OpenCV C++ template for Visual Studio 2015 here ! (Warning: If you use this template, please don't upload the whole project. Only the source codes should be submitted. e.g. main.cpp, funtion.h )

  • Write a program which does:
    • (a) Generate noisy images with gaussian noise(amplitude of 10 and 30)
    • (b) Generate noisy images with salt-and-pepper noise( probability 0.1 and 0.05)
    • (c) Use the 3x3, 5x5 box filter on images generated by (a)(b)
    • (d) Use 3x3, 5x5 median filter on images generated by (a)(b)
    • (e) Use both opening-then-closing and closing-then opening filter (using the octogonal 3-5-5-5-3 kernel, value = 0) on images generated by (a)(b)
    • You must calculate the signal-to-ratio (SNR) for each instance(4 noisy images and 24 processed images)

Announcement

  • You must include your noisy image before processing and after processing in your report.
  • You must calculate the signal-to-ratio (SNR) for each instance and write them in your report. Use this formula if any conflicts occur.
  • You are to generate gaussian noise with amplitude of 10 and 30, salt-and-pepper noise with probability 0.1 and 0.05. You must use the 3x3, 5x5 box filter and median filter, both opening-then-closing and closing-then opening filter (using the octogonal 3-5-5-5-3 kernel, value = 0) on those images. You will produce 24 images and 4 noise figures.
  • Here is a simple pseudo normal random number generator with mean 0 and variance 1. If your programming language provides an API for pseudo normal random numbers (i.e., randn in matlab, you may use it as an exception to hard code programming.
  • You can use any programing language to implement homework, however, you'll get zero point if you just call existing library.

FAQ

  • Q1: 有規定報告的頁數嗎?
      本次作業報告可以僅附結果圖(4 noise,24處理過的影像,共28張),及每張影像的SNR。不必附上解釋。
      報告可以一張noise圖搭配6張對該noise圖處理的影像做排版,共四組,可以看出不同方法處理過後的差異。
      參考範例(pdf)
  • Q2: 請問之前作業實作過的函式,以後作業可以直接 call 現成函式嗎?
      可以哦,如果是之前作業手刻過的函式,之後用到可以任意 call function.
  • Q3: random number的使用限制是如何? 例如我使用python的random.gauss和random.uniform是可以的嗎?
      Random number 可任意call function,例如random.gauss、random.uniform、、np.random.normal, np.random.uniform等
  • Q4: 圖像的邊緣要怎麼處理?
      可以先做padding, 然後對邊界裡面pixel做filter,這樣結果大小就可跟原圖一樣
      Padding 方式可用reflect,或是你要用其他方式padding 也可以。
      可直接用opencv function,如:copyMakeBorder
      如果不處理邊界也可以,我改的時候不會因為你邊界不對就扣分。
  • Q5: 如何確定我的SNR有沒有算對
      提供兩張圖片給您做測試, lena.bmp, median_5x5.bmp
      SNR算出來的值大約會落在15.67369
      在算SNR之前要記得把影像從0~255 normalize到 0~1喔。