No Slide Title
Total Page:16
File Type:pdf, Size:1020Kb
Chapter 5 Image Restoration 國立雲林科技大學 資訊工程研究所 張傳育(Chuan-Yu Chang ) 博士 Office: EB 212 TEL: 05-5342601 ext. 4516 E-mail: [email protected] Web: http://MIPL.yuntech.edu.tw Chapter 5 Image Restoration Image Degradation/Restoration Process The objective of restoration is to obtain an estimate fˆ ( x , y ) of the original image. fˆ(x, y) will be close to f(x,y). Restoration的目的在於獲得原始影像的 估計影像,此估計影像應儘可能的接近 原始影像。 2 Image Degradation/Restoration Process The degraded image is given in the spatial domain by Degradation function g(x, y) = h(x, y)* f (x, y) +η(x, y) (5.1-1) noise The degraded image is given in the frequency domain by G(u,v) = H (u,v)F(u,v) + N(u,v) (5.1-2) 3 Noise Models: Some Important Probability Density Functions The principal sources of noise arise during Image acquisition and transmission Gaussian noise (normal noise): The PDF of a Gaussian random variable, z, is given by 1 2 2 p(z) = e−(z−µ ) / 2σ 2πσ Rayleigh noise: The PDF of Rayleigh is given by 2 2 (z − a)e−(z−a) /b for z ≥ a p(z) = b 0 for z < a 2 b(4 −π ) µ = a + πb / 4,σ = − ab zb 1 4 e−az for z ≥ 0 p(z) = (b −1)! Erlang (Gamma) noise 0 for z < 0 b b µ = ,σ 2 = a a2 4 Noise Models ae−az for z ≥ 0 p(z) = < Exponential noise 0 for z 0 1 1 µ = ,σ 2 = a a2 Uniform noise 1 if a ≤ z ≤ b p(z) = b − a 0 otherwise a + b (b − a)2 µ = ,σ 2 = 2 12 Impulse (salt and pepper) noise Pa for z = a p(z) = Pb for z = b 0 otherwise 5 Some important probability density function 偏離原點的位移, 向右傾斜 6 Example 5.1 Sample noisy images and their histograms 下圖為原始影像,將在此圖中加入不同的雜訊。 7 Example 5.1 (cont.) Sample noisy images and their histograms 8 Example 5.1 (cont.) Sample noisy images and their histograms 9 Periodic Noise Periodic Noise Arises typically from electrical or electromechanical interference during image acquisition. It can be reduced via frequency domain filtering. Estimation of Noise Parameters Estimated by inspection of the Fourier spectrum of the image. Periodic noise tends to produce frequency spikes that often can be detected by visual analysis. From small patches of reasonably constant gray level. The heights of histogram are different but the shapes are similar. 10 Example 影像遭受 sinusoidal noise的破壞 有規則性的亮點 影像的 spectrum 11 Fig 5.4(a-c)中的某小塊影像的histogram Histogram的形狀幾乎和Fig.4 (d,e,k)的形狀一樣但高度不同。 12 Periodic Noise The simplest way to use the data from the image strips is for calculating the mean and variance of the gray levels. µ = ∑ zi p(zi ) (5.2-15) zi∈S 2 2 (5.2-16) σ = ∑(zi − µ) p(zi ) zi∈S The shape of the histogram identifies the closest PDF match. 13 Restoration in the presence of noise only-spatial filtering When the only degradation present in an image is noise, Eq. (5.1-1) and (5.1-2) become g(x, y) = f (x, y) +η(x, y) (5.3-1) G(u,v) = F(u,v) + N(u,v) (5.3-2) The noise terms (η(x,y), N(u,v)) are unknown, so subtracting them from g(x,y)or G(u,v) is not a realistic option. In periodic noise, it is possible to estimate N(u,v) from the spectrum of G(u,v). 14 Restoration in the presence of noise only-spatial filtering Mean Filter Arithmetic mean filter Let Sxy represent the set of coordinates in a rectangular subimage windows of size mxn, centered at point (x,y). The arithmetic mean filtering process computes the average value of the corrupted image g(x,y) in the area defined by Sxy. 1 fˆ(x, y) = ∑ g(s,t) mn (s,t)∈Sxy This operation can be implemented using a convolution mask in which all coefficients have value 1/mn. Noise is reduced as a result of blurring 15 Mean Filter (cont.) Geometric mean filter Each restored pixel is given by the product of the pixels in the subimage window, raised to the power 1/mn. 1 mn fˆ(x, y) = ∏ g(s,t) ∈ (s,t) Sxy A geometric mean filter achieves smoothing comparable to the arithmetic mean filter, but it tends to lose less image detail in the process. 16 Example 5.2 被平均值0,變異數 400的加成性高斯雜訊 Illustration of mean filters 破壞的結果 Result of arithmetic mean filter Result of geometric mean filter 17 Restoration in the presence of noise only-spatial filtering Harmonic mean filter ˆ mn 可濾除salt noise, f (x, y) = 但對pepper noise則失敗 ∑ 1 (s,t)∈Sxy g(s,t) Contra-harmonic mean filter Q+1 若 Q>0 可濾除pepper noise, ∑ g(s,t) 若 Q<0 可濾除salt noise, ∈ 若 為算數平均 ˆ (s,t) Sxy Q=0 f (x, y) = 若 為 ∑ g(s,t)Q Q=-1 Harmonic mean (s,t)∈Sxy 18 被機率0.1的salt雜訊 被機率0.1的pepper雜 Chapter 5 破壞的結果 訊破壞的結果 Image Restoration Contraharmonic mean filter, Q=1.5 濾波的結果 The positive-order filter did a better job of cleaning the background. In general, the arithmetic and geometric mean filters are well suited for random noise. The contra-harmonic filter is well 19 suited for impulse noise Contraharmonic mean filter, Q= -1.5 濾波的結果 Results of selecting the wrong sign in contra- harmonic filtering The disadvantage of contraharmonic filter is that it must be known whether the noise is dark or light in order to select the proper sign for Q. The result of choosing the wrong sign for Q can be disastrous. 在contra-harmonic filter中選取錯誤正負號所導致的結果 20 Order-Statistics Filters The response of the order-statistics filters is based on ordering (ranking) the pixels contained in the image area encompassed by the filter. Median filter Replaces the value of a pixel by the median of the gray levels in the neighborhood of that pixel. (5.3-7) fˆ(x, y) = median{g(s,t)} (s,t)∈Sxy Median filter provide excellent noise-reduction capabilities, with considerably less blurring than linear smoothing filters of similar size. Median filters are particularly effective in the presence of both bipolar and unipolar impulse noise. 21 Order-Statistics Filters (cont.) Max filter This filter is useful for finding the brightest points in an image. It reduces pepper noise fˆ(x, y) = max {g(s,t)} (5.3-8) (s,t)∈Sxy Min filter This filter is useful for finding the darkest points in an image It reduces salt noise. (5.3-9) fˆ(x, y) = min {g(s,t)} (s,t)∈Sxy 22 Order-Statistics Filters (cont.) Midpoint filter This filter works best for randomly distributed noise, such as Gaussian or uniform noise. 1 fˆ(x, y) = max {g(s,t)}+ min {g(s,t)} (5.3-10) ∈ ∈ 2 (s,t) Sxy (s,t) Sxy Alpha-trimmed mean filter We delete the d/2 lowest and the d/2 higest gray-level values of g(s,t) in the neighborhood Sxy. 1 fˆ(x, y) = g (s,t) − ∑ r (5.3-11) mn d (s,t)∈Sxy 先刪除0.5d最大與最小的灰階值,再求剩下的灰階平均值 當d=0,則為mean filter 當d=(mn-1)/2時,為median filter 23 Result of one pass with a median filter of size Example 5.3 3x3, several noise points are still visible. Illustration of order-statistics filters Image corrupted by salt and pepper noise with probabilities Pa=Pb=0.1 Result of processing (c) with median filter again Result of processing (b) with median filter again 24 Example 5.3 Illustration of order-statistics filters Result of filtering with Result of filtering with a max filtering a min filtering 25 Example 5.3 Illustration of order-statistics filters Image corrupted by Image corrupted by additive uniform additive salt-and- noise (variance 800 pepper noise and zero mean) (Pa=Pb=0.1) Result of filtering (b) Result of filtering (b) with a 5x5 arithmetic with a geometric mean filter mean filter Result of filtering (b) Result of filtering (b) with a median filter with a alpha-trimmed mean filter with d=5 26 Adaptive Filter Adaptive Filter The behavior changes based on statistical characteristics of the image inside the filter region defined by the m x n rectangular windows Sxy. The price paid for improved filtering power is an increase in filter complexity. Adaptive, local noise reduction filter The mean gives a measure of average gray level in the region. The variance gives a measure of average contrast in that region. The response of the filter at any point (x,y) on which the region is centered is to be based on four quantities: g(x,y): the value of the noisy image. 2 ση , the variance of the noise corrupting f(x,y) to form g(x,y) mL, the local mean of the pixels in Sxy. 2 σ L , the local variance of the pixels in Sxy. 27 Adaptive local noise reduction filter The behavior of the adaptive filter to be as follows: If the variance of noise is zero, the filter should return simply the value of g(x,y). If the local variance is high relative to the variance of noise, the filter should return a value close to g(x,y). If the two variances are equal, return the arithmetic mean value of the pixels in Sxy. An adaptive expression for obtaining estimated fˆ(x, y) based on these assumptions may be written as The only quantity that σ 2 ˆ = − η ( )− Needs to be known f (x, y) g(x, y) 2 [g x, y mL ] (5.3-12) σ L 28 Example 5.4 Illustration of adaptive, local Arithmetic mean noise-reduction filtering 7*7 Gaussian noise geometric mean Adaptive filter 7*7 29 Adaptive median filter Adaptive median filtering can handle impulse noise, it seeks to preserve detail while smoothing nonimpulse noise.