天天看點

matlab中值濾波法算法,基于MATLAB中值濾波算法的優化與實作

總第238期2014年第4期 艦 船 電 子 工 程 Ship Electronic Engineering Vol.34No.437 基于 MATLAB中值濾波算法的優化與實作* 趙建春 劉力源 (陸軍軍官學院研究所學生管理大隊 合肥 230031) 摘 要 介紹了中值濾波的濾波特點,針對标準中值濾波在濾除椒鹽噪聲中的不足,提出了一種中值濾波優化算法,通過 MATLAB軟體仿真,結果表明該算法在有效地去除椒鹽噪聲的同時,很好地保護了邊緣細節,較标準中值濾波具有更優良的濾波效果。 關鍵詞 中值濾波;椒鹽噪聲;MATLAB中圖分類号 TP317  DOI:10.3969/ j.issn1672-9730.2014.04.011 Optimization of Median FilteringAl gorithm Based on MATLAB ZHAO Jianchun LIU Li yuan ( Graduate Administrative Department,Army Officer Academy,Hefei 230031) Abstract The filtering characteristics of the median filter,according to the standard median filter.In filtering out thedeficiency of the salt and pepper noise,a median filter optimization algorithm is proposed.Through the MATLAB softwaresimulation,the results show that the algorithm effectively removes the salt and pepper noise while protecting the edge details of the standard median filter has better filtering effect. Key Words median filter,salt and pepper noise,MATLAB Class Number TP317 1 引言 非線性濾波[ 1]較傳統的線性濾波在濾除噪聲的同時,能最大限度地保持圖像信号的邊緣細節,使圖像清晰、逼真,進而得到廣泛研究和應用。常用的中值濾波是非線性濾波的代表。雖然典型的中值濾波能夠減少圖像中的椒鹽噪聲,但是當椒鹽噪聲在空間出現的機率較大時,中值濾波器為了濾除噪聲,不得不增大濾波視窗,在濾除噪聲的同時損失了信号的高頻資訊,使圖像的邊緣等細節模糊,産生較嚴重的失真[ 2~3]。本文對中值濾波算法進行分析,給出中值濾波優化算法,使圖像在有效濾除噪聲的同時,能較好地保護圖像的邊緣細節,以提高圖像處理效果。 2 中值濾波 中值濾波[ 4]是基于排序統計理論的一種能有 效抑制脈沖噪聲的非線性信号處理技術。一個中值濾波器的輸出可寫為 g ( x , y )= median ( s , t )∈ N ( x , y ) { f ( s , t )} ( 1) 式中, f ( s , t ), g ( x , y )分别為原始圖像和處理後圖 像, N ( x , y )是以( x , y )為中心的 n × n 矩形濾波窗 口( n 為奇數),median是将濾波視窗中的 n 2個像 素點按灰階值大小排序後取中值,其流程圖如圖1所示。 圖1 中值濾波