image noise and filtering
Post on 14-Jan-2017
227 Views
Preview:
TRANSCRIPT
Department of Computer EngineeringUniversity of California at Santa Cruz
Image Noise and Filtering
CMPE 264: Image Analysis and Computer VisionHai Tao
Department of Computer EngineeringUniversity of California at Santa Cruz
Estimating acquisition noise
Noise introduced by imaging systemSimple model• Assumption: noise at each pixel is independent, characterized by
its mean and standard deviation• Estimating the mean and the standard deviation for each pixel
• For most imaging system,
2/11
0
2
1
0
)),(),((1
1),(
),(1),(
,1,...,0,
⎟⎠⎞
⎜⎝⎛ −
−=
=
−=
∑
∑
−
=
−
=
N
kk
N
kk
jiIjiIN
ji
jiIN
jiI
letNjieachFor
σ
σ
5.2≈σ
Department of Computer EngineeringUniversity of California at Santa Cruz
Estimating acquisition noise
Estimating auto-covariance• In reality, the noise in neighboring pixels is not independent• The correlation is described by auto-covariance• If we assume auto-covariance of noise is the same everywhere in
the image, then
• Example: How to compute for a 10x10 image ?
∑ ∑= =
++−++−=
−=−−=−−=
' '
0 02
''
))','()','())(,(),((1)','(
,1,...,0',',1',1'i jN
i
N
jkkII
ji
jjiiIjjiiIjiIjiIN
jiC
computeNjieachforjNNiNNLet
)1,2(IIC
∑ ∑= =
++−++−=
====7
0
8
02
''
))','()','())(,(),((10
1)1,2(
,1',2',8,7
i jkkII
ji
jjiiIjjiiIjiIjiIC
computejieachforNN
Department of Computer EngineeringUniversity of California at Santa Cruz
Estimating acquisition noise
Auto-covariance for a typical imaging system. Notice that the covariance along the horizontal direction, which is a characteristic often observed in CCD cameras
Department of Computer EngineeringUniversity of California at Santa Cruz
Modeling image noise
Additive noise model
Signal-to-noise ratio (SNR), often expressed in decibel
20 dB means
),(),(),(ˆ),(),(
jinjiIjiI
jiIvaluepixeltoaddedjinnoiseRandom
+=
n
sSNRσσ
=
)(log10 10n
sdBSNR
σσ
=
100=n
s
σσ
Department of Computer EngineeringUniversity of California at Santa Cruz
Modeling image noise
Gaussian noise -white Gaussian, zero-mean stochastic process• White – n(i,j) independent in both space and time• Zero-mean –• Gaussian - n(i,j) is random variable with distribution
Impulsive noise – also called peak, spot, or salt and pepper noise, caused by transmission errors, faulty CCD sites, etc.
are two uniformly distributed random variables
0),( =jiI
2
2
2
21)( σ
πσ
x
exp−
=
⎩⎨⎧
≥−+<
=lxIIyIlxjiI
jiIsp )(),(
),(minmaxmin
]1,0[, ∈yx
Department of Computer EngineeringUniversity of California at Santa Cruz
Modeling image noise
Example: Gaussian noise and salt and pepper noise, l=0.99
Department of Computer EngineeringUniversity of California at Santa Cruz
Filtering noise - denoise
Goal: recover fromMethods: linear filtering and nonlinear filteringLinear filtering: replace the original pixel by the weighted sum of its neighboring pixel. The weights are the filter coefficients
),( jiI ),(),(),(ˆ jinjiIjiI +=
∑ ∑−= −=
−−=∗=
×2/
2/
2/
2/),(),(),(
::
m
mh
m
mkA kihiIkhAAIjiI
mm sizekernel,filterAimageoriginalI
Department of Computer EngineeringUniversity of California at Santa Cruz
Mean filter – smoothing by averaging
The basic assumption is that the noise has higher frequency and the signal has lower frequency. Noise can be canceled by low-pass filteringA averaging filter with m=5 is
Why does it work ?• Explanation in spatial domain: reduce standard deviation by 5• Explanation in frequency domain: suppress high frequency
components since
⎥⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢⎢
⎣
⎡
=
1111111111111111111111111
251
avgA
)()()( AFIFAIF =∗
Department of Computer EngineeringUniversity of California at Santa Cruz
Gaussian filter
The Fourier transform of a Gaussian kernel is also Gaussian, better low-pass filter than averaging filter
Gaussian kernel is separable, which means 2D Gaussian filtering can be implemented as two 1D Gaussian filtering
∑ ∑
∑ ∑
∑ ∑
−= −=
−−
−= −=
+−
−= −=
−−=
−−=
−−=∗=
2/
2/
2/
2/
22
2/
2/
2/
2/
2
2/
2/
2/
2/
),(
),(
),(),(
2
2
2
2
2
22
m
mh
m
mk
kh
m
mh
m
mk
kh
m
mh
m
mkG
kihiIee
kihiIe
kihiIkhGGII
σσ
σ
2
22
2),( σkh
ekhG+
−=
Department of Computer EngineeringUniversity of California at Santa Cruz
Gaussian filter
SEPAR_FILTER• Build a 1-D Gaussian filter g, of width• Convolve each row of I with g, yielding a new image Ir
• Convolve each column of Ir with g, yielding a new image IG
Construction of Gaussian filter• In order to subtend 98.76% of the area in the Gaussian function,
for a given , the width of the filter need to be five times of ,or
• Integer filter: Gaussian filter can be implemented efficiently by converting the real numbers into rational numbers with a common denominator: scale the filter so that the smallest components are 1s, replace the other entries with the closest integers
Gg σσ =
σ σσ5=w
Department of Computer EngineeringUniversity of California at Santa Cruz
Gaussian filter
Example• Filter image with Gaussian
noise• Filter image with salt and
pepper noise
Department of Computer EngineeringUniversity of California at Santa Cruz
Nonlinear filtering
Median filtering• Algorithm MED_FILTER• For each pixel I(i,j) and its neighborhood,
- Sort its neighboring pixels- Assign the median value to I(i,j)
• Example: with window/mask size
])}2/,2/[,|),({ nnkhkihiI −∈++nn×
10110810118191041019721241021022022191029910021211061051021722
33×
10110810118191041019721241021029721191021029921211061051021722
Department of Computer EngineeringUniversity of California at Santa Cruz
Median filtering
Example with Gaussian noise• Preserve discontinuity in the
signal. • No contribution from pixels
with large noise• Expensive to compute
Department of Computer EngineeringUniversity of California at Santa Cruz
Homework
Use Matlab to complete the following experiment• Read in a gray-level image• Add Gaussian noise to the image with • Implement
- 5 by 5 Separable Gaussian filter with - 5 by 5 Median filter
• Turn in - Matlab code for adding noise and the two filtering algorithms- The original image, the image with noise, and the filtering
results- Derivation of the discrete Gaussian filter
10=σ
8.0=σ
top related