330 likes | 507 Views
Mean and Median Filters. 指導教授:張顧耀 學生姓名:張志坤 學號: E9406011. Outline. Introduction Mean Filter Median Filter Summary Demo. Introduction. 影像濾波的定義. 主要分成兩種方式: 頻率域 (frequency domain) :由空間域影像透過 轉換 ( 如複利葉 , 小波 ) 而形成的影像表示空間
E N D
Mean and Median Filters 指導教授:張顧耀 學生姓名:張志坤 學號:E9406011
Outline • Introduction • Mean Filter • Median Filter • Summary • Demo Mean and Median Filters
Introduction • 影像濾波的定義 • 主要分成兩種方式: • 頻率域(frequency domain) :由空間域影像透過 轉換 (如複利葉, 小波) • 而形成的影像表示空間 • 空間域(spatial domain) :直接對影像上的 pixel value做處理 空間域的方程式表示 g(x,y) = T[ f(x,y) ] f(x,y) 是輸入的影像 g(x,y) 是經過處理的影像 T ->影像濾波的方法 Mean and Median Filters
Introduction • 影像濾波的定義( 方程式 g(x,y) = T[ f(x,y) ] ) Original Original y y (x,y) (x,y) Image f(x,y) Image g(x,y) x x g(x,y) = T[ f(x,y) ] f(x,y) 是輸入的影像 g(x,y) 是經過處理的影像 T ->影像濾波的方法 Mean and Median Filters
Outline • Introduction • Mean Filter • Median Filter • Summary • Demo Mean and Median Filters
Mean Filter The Mean Filter is used to soften an image by averaging surrounding pixel values. Mean and Median Filters
Original Original y y (x,y) (x,y) Image f(x,y) x Image g(x,y) x Mean Filter Grayscale 3x3 pixel window (x,y) Center pixel = ( 22 + 77 + 48 + 150 + 77 + 158 + 0 + 77 + 219 ) / 9= 92 Mean and Median Filters
Mean Filter (a) 加入點雜訊的方形影像; (b) 點雜訊方形影像的輪廓圖; (c) 經平均值濾波後的影像; (d) 平均值濾波後的輪廓圖。 Mean and Median Filters
Original y (x,y) Image f(x,y) x Mean Filter • 演算法 int x , y ; int a=(n-1)/2; int color(i) , color(x,y); for(int k=x-a ; k<=x+a ; k++) { for(int m=y-a ; m<=y+a ; m++) { color(x,y)+=color(k,m) } } color(i)=[color(x, y)/n*n); Mean and Median Filters
Original y (x,y) Image f(x,y) x Mean Filter • ITK Header file included #include “itkMeanImageFilter.h” Using Typedef Itk::MeanImageFilter < InputImageType, OutputImageType > FilterType; FilterType::Pointer filter = FilterType::New((); InputImageType::SizeType indexRadius; indexRadius[0] = 1; // radius along x 1-> 2D 2-> 3*5 indexRadius[1] = 1; // radius along y Rx * 2 + 1= 2 * 1 + 1 = 3 Rx 就是 x 方向的半徑, 1 代表中心點 Ry * 2 + 1 = 2 * 1 + 1 = 3Ry 就是y 方向的半徑, 1 代表中心點 Mean and Median Filters
Mean Filter Mean Source Mean and Median Filters
Mean Filter Source Mean Mean and Median Filters
Outline • Introduction • Mean Filter • Median Filter • Summary • Demo Mean and Median Filters
Median Filter The Median filter is used to remove noise from an image by replacing pixels with the middle pixel value selected from a certain window size. Mean and Median Filters
Original Original y y (x,y) (x,y) Image f(x,y) x Image g(x,y) x Median Filter Grayscale 3x3 pixel window (x,y) 0, 22, 48, 77, [ 77 ], 77, 150, 158, 219 Mean and Median Filters
Median Filter (a) 加入點雜訊的方形影像; (b) 點雜訊方形影像的輪廓圖; (c) 經中間值濾波後的影像; (d) 中間值濾波後的輪廓圖。 Mean and Median Filters
Median Filter • 演算法 int x , y ; int z=0; int a=(n-1)/2; int color(i) ; int array[] = new int [nxn-1]; for(int k=x-a ; k<=x+a ; k++) { for(int m=y-a ; m<=y+a ; m++) { array [z]=color(k,m) z++; } } sort(array); color(i)=median(array []); Mean and Median Filters
Original y (x,y) Image f(x,y) x Median Filter • ITK Header file included #include “itkMedianImageFilter.h” Using Typedef Itk::MedianImageFilter < InputImageType, OutputImageType > FilterType; FilterType::Pointer filter = FilterType::New((); InputImageType::SizeType indexRadius; indexRadius[0] = 1; // radius along x 1-> 2D 2-> 3*5 indexRadius[1] = 1; // radius along y Mean and Median Filters
Median Filter 3×3 median filtering Source Mean and Median Filters
Median Filter Source 3×3 median filtering 9×9 median filtering Mean and Median Filters
Outline • Introduction • Mean Filter • Median Filter • Summary • Demo Mean and Median Filters
Summary • Mean filter and Median filter的比較 - 1 Mean and Median Filters
Summary • Mean filter and Median filter的比較 - 2 Mean filter Median filter Mean and Median Filters
Summary • Mean filter and Median filter的比較 - 3 (c) 平均值濾波輸出 Mean and Median Filters
Outline • Introduction • Mean Filter • Median Filter • Summary • Demo Mean and Median Filters
Demo Mean and Median Filters
Demo Mean and Median Filters
參考文獻 • ItkSoftwareGuide.pdf • http://www.cee.hw.ac.uk/hipr/html/mean.html • http://www.ntut.edu.tw/~s9598008/homework1.htm • http://www.cc.ntut.edu.tw/~s8410010/hw1.htm • 連國珍,“數位影像處理”,儒林圖書公司(SIM 949)。 • http://140.128.102.71/東海大學影像視訊處理實驗室 Mean and Median Filters
報告結束 敬請指教 Mean and Median Filters