This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
EE465: Introduction to Digital Image Processing 1
Limitation of Imaging Technology Two plagues in image acquisition
Noise level p=0.1 means that approximately 10% of pixels are contaminated bysalt or pepper noise (highlighted by red color)
EE465: Introduction to Digital Image Processing 11
MATLAB Command>Y = IMNOISE(X,'salt & pepper',p)
Notes:
The intensity of input images is assumed to be normalized to [0,1].If X is double, you need to do normalization first, i.e., X=X/255;If X is uint8, MATLAB would do the normalization automatically The default value of p is 0.05 (i.e., 5 percent of pixels are contaminated) imnoise function can produce other types of noise as well (you need to change the noise type ‘salt & pepper’)
EE465: Introduction to Digital Image Processing 12
Impulse Noise Removal Problem
Noisy image Y
filteringalgorithm
Can we make the denoised image X as closeto the noise-free image X as possible?
^
X̂denoisedimage
EE465: Introduction to Digital Image Processing 13
Median Operator Given a sequence of numbers {y1,
…,yN} Mean: average of N numbers Min: minimum of N numbers Max: maximum of N numbers Median: half-way of N numbersExample ]56,55,54,255,52,0,50[y
54)( ymedian
]255,56,55,54,52,50,0[y
sorted
EE465: Introduction to Digital Image Processing 14
y(n)
W=2T+1
)](),...,(),...,([)(ˆ TnynyTnymediannx
1D Median Filtering
… …
Note: median operator is nonlinear
MATLAB command: x=median(y(n-T:n+T));
EE465: Introduction to Digital Image Processing 15
Numerical Example]56,55,54,255,52,0,50[yT=1:
],56,55,54,255,52,0,50,[ 5650y
]55,55,54,54,52,50,50[ˆ x
BoundaryPadding
EE465: Introduction to Digital Image Processing 16
x(m,n)
W: (2T+1)-by-(2T+1) window
2D Median Filtering
)],(),...,,(),...,,(),...,,(),...,,([),(ˆ
TnTmyTnTmynmyTnTmyTnTmymediannmx
MATLAB command: x=medfilt2(y,[2*T+1,2*T+1]);
EE465: Introduction to Digital Image Processing 17
EE465: Introduction to Digital Image Processing 27
MATLAB Command
>Y = IMNOISE(X,’gaussian',m,v)
>Y = X+m+randn(size(X))*v;or
Note:rand() generates random numbers uniformly distributed over [0,1]randn() generates random numbers observing Gaussian distributionN(0,1)
EE465: Introduction to Digital Image Processing 28
Image Denoising
Noisy image Y
filteringalgorithm
Question: Why not use median filtering?Hint: the noise type has changed.
X̂denoisedimage
EE465: Introduction to Digital Image Processing 29
f(n) h(n) g(n)
)()()()()()()( nhnfnfnhknfkhngk
- Linearity
- Time-invariant property
)()()()( 22112211 nganganfanfa
)()( 00 nngnnf
Linear convolution
1D Linear Filtering
See review section
EE465: Introduction to Digital Image Processing 30
jwnenfwF )()(
dwewFnf jwn)(
21)(
forward
inverse
Note that the input signal is a discrete sequence while its FT is a continuous function
)()( nhnf time-domain convolution
)()( wHwFfrequency-domain multiplication
Fourier Series
EE465: Introduction to Digital Image Processing 31
Filter Examples
0 0.5 1 1.5 2 2.5 3 3.50
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
LP HP
w
|H(w)|Low-pass (LP)
h(n)=[1,1]
|h(w)|=2cos(w/2)
High-pass (LP)
h(n)=[1,-1]
|h(w)|=2sin(w/2)
EE465: Introduction to Digital Image Processing 32
forward transform inverse transform
• Properties- periodic
- conjugate symmetric
)()( kyNky
)()( * kykNy
1D Discrete Fourier Transform
Proof:
1
0
)()(N
n
knNWnxky
1
0
)()(N
n
knNWkynx
1
0
1
0
)( )()(N
n
knNn
N
n
nNkNn kyWxWxNky
1
0
*1
0
)( )()(N
n
knNn
N
n
nkNNn kyWxWxkNyProof:
}2exp{NjWN
EE465: Introduction to Digital Image Processing 33
Matrix Representation of 1D DFT
FA
NNN
N
NN
aa
aa
..............................
......
1
111
1,
,1
2
NN
Nj
N
klNkl
WeW
WN
a
Re
Im
NWklN
N
llk Wx
Ny
1
1
N
llklk xay
1
DFT:
EE465: Introduction to Digital Image Processing 34
Fast Fourier Transform (FFT)*
Invented by Tukey and Cooley in 1965 Basic idea: divide-and-conquer
Reduce the complexity of N-point DFT from O(N2) to O(Nlog2N)
122/12
22/2
12
)12(12
2
22
1
0
mn
kmNm
k
mn
kmNm
mn
mkNm
mn
mkNm
N
n
knNnk
WxWWx
WxWxWxy
N
N/2-point DFT N/2-point DFT
N-point DFT
EE465: Introduction to Digital Image Processing 35
Filtering in the Frequency Domain
)()()( nhnfng
convolution in the time domain is equivalent to multiplication in the frequency domain
)()()( kHkFkG
f(n) h(n) g(n) F(k) H(k) G(k)
DFT
EE465: Introduction to Digital Image Processing 36
2D Linear Filtering
f(m,n) h(m,n) g(m,n)
),(),(),(),(),(,
nmfnmhlnkmflkhnmglk
2D convolution
MATLAB function: C = CONV2(A, B)
EE465: Introduction to Digital Image Processing 37
2D Filtering=Two Sequential 1D Filtering
Just as we have observed with 2D transform, 2D (separable) filtering can be viewed as two sequential 1D filtering operations: one along row direction and the other along column direction
The order of filtering does not matter )()()()(),( 1111 mhnhnhmhnmh
h1 : 1D filter
EE465: Introduction to Digital Image Processing 38