Computer Vision 1628768300
Computer Vision 1628768300
h13 x02
2πσ
h21 y20
M = 1 4 7 4 1
h22 x03 4 16 26 16 4
h23 y30
1
h x0 7 26 40 26 7 ∗ 272
5 × 5 Gauss. (σ = 1)
31 4 4 16 26 16 4
h32 y40 1 4 7 4 1
Digital Filters Median Filter
Convolution • reduces noise, but preserves details.
• replace each pixel with the median of its
For an n × m kernel K:
m n
neighbourhood.
2
X 2
X • sort values (keep duplicates) and pick the
I(x, y) = I1 (x + k, y + l)K(k, l) middle one (or average of two middles if
k=− m
2
l=− n
2 even).
• median(I1 + I2 ) 6= median(I1 ) + median(I2 ).
Noise
Kuwahara Filter
1. Salt & pepper noise: the color of a noisy
pixel has no relation to surrounding pixels. • edge-preserving filter, doesn’t disturb
2. Gaussian noise: each pixel is changed from sharpness and position of edges.
PN
its original value by a small amount. 2
i=1 (I(xi ) − mean)
Variance: σ 2 =
Smoothing Filters N
Linear Filters
1. Calculate mean and variance of each 3 × 3
LF ilter(I1 + I2 ) = LF ilter(I1 ) + LF ilter(I2 ) region (upper left, upper right, lower left, &
1. Uniform (mean) filter lower right).
2. Triangular filter 2. Output value of center pixel = mean value of
3. Gaussian filter region of smallest variance.
Non-linear Filters
1. Median filter
2. Kuwahara filter
Uniform (Mean) Filter
• replace each pixel with the mean of its
neighbourhood.
• all coeffs. in kernel have same weights.
• smoothing effect increases with kernel size.
• filter is always normalized (divide by sum of
weights).
1 1 1
1
1 1 1 ∗ 9
3 × 3 rectang. OR circ. kernel (R = 1.5)
1 1 1
1 1 1 1 1
1 1 1 1 1
1
1 1 1 1 1 ∗ 25
5 × 5 rectang. kernel
1 1 1 1 1
1 1 1 1 1
0 1 1 1 0
1 1 1 1 1
1
1 1 1 1 1 ∗ 21
5 × 5 circ. kernel (R = 2.5)
1 1 1 1 1
0 1 1 1 0