image noise and filtering
TRANSCRIPT
![Page 1: Image Noise and Filtering](https://reader034.vdocuments.site/reader034/viewer/2022051404/5879dcc51a28ab613f8b50d7/html5/thumbnails/1.jpg)
Department of Computer EngineeringUniversity of California at Santa Cruz
Image Noise and Filtering
CMPE 264: Image Analysis and Computer VisionHai Tao
![Page 2: Image Noise and Filtering](https://reader034.vdocuments.site/reader034/viewer/2022051404/5879dcc51a28ab613f8b50d7/html5/thumbnails/2.jpg)
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≈σ
![Page 3: Image Noise and Filtering](https://reader034.vdocuments.site/reader034/viewer/2022051404/5879dcc51a28ab613f8b50d7/html5/thumbnails/3.jpg)
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
![Page 4: Image Noise and Filtering](https://reader034.vdocuments.site/reader034/viewer/2022051404/5879dcc51a28ab613f8b50d7/html5/thumbnails/4.jpg)
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
![Page 5: Image Noise and Filtering](https://reader034.vdocuments.site/reader034/viewer/2022051404/5879dcc51a28ab613f8b50d7/html5/thumbnails/5.jpg)
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
σσ
![Page 6: Image Noise and Filtering](https://reader034.vdocuments.site/reader034/viewer/2022051404/5879dcc51a28ab613f8b50d7/html5/thumbnails/6.jpg)
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
![Page 7: Image Noise and Filtering](https://reader034.vdocuments.site/reader034/viewer/2022051404/5879dcc51a28ab613f8b50d7/html5/thumbnails/7.jpg)
Department of Computer EngineeringUniversity of California at Santa Cruz
Modeling image noise
Example: Gaussian noise and salt and pepper noise, l=0.99
![Page 8: Image Noise and Filtering](https://reader034.vdocuments.site/reader034/viewer/2022051404/5879dcc51a28ab613f8b50d7/html5/thumbnails/8.jpg)
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
![Page 9: Image Noise and Filtering](https://reader034.vdocuments.site/reader034/viewer/2022051404/5879dcc51a28ab613f8b50d7/html5/thumbnails/9.jpg)
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 =∗
![Page 10: Image Noise and Filtering](https://reader034.vdocuments.site/reader034/viewer/2022051404/5879dcc51a28ab613f8b50d7/html5/thumbnails/10.jpg)
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+
−=
![Page 11: Image Noise and Filtering](https://reader034.vdocuments.site/reader034/viewer/2022051404/5879dcc51a28ab613f8b50d7/html5/thumbnails/11.jpg)
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
![Page 12: Image Noise and Filtering](https://reader034.vdocuments.site/reader034/viewer/2022051404/5879dcc51a28ab613f8b50d7/html5/thumbnails/12.jpg)
Department of Computer EngineeringUniversity of California at Santa Cruz
Gaussian filter
Example• Filter image with Gaussian
noise• Filter image with salt and
pepper noise
![Page 13: Image Noise and Filtering](https://reader034.vdocuments.site/reader034/viewer/2022051404/5879dcc51a28ab613f8b50d7/html5/thumbnails/13.jpg)
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
![Page 14: Image Noise and Filtering](https://reader034.vdocuments.site/reader034/viewer/2022051404/5879dcc51a28ab613f8b50d7/html5/thumbnails/14.jpg)
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
![Page 15: Image Noise and Filtering](https://reader034.vdocuments.site/reader034/viewer/2022051404/5879dcc51a28ab613f8b50d7/html5/thumbnails/15.jpg)
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=σ