- 4. Lecture
Image enhancement: Filtering
1
4. Lecture Image enhancement: Filtering 1 Image preprocessing - - PowerPoint PPT Presentation
4. Lecture Image enhancement: Filtering 1 Image preprocessing Aims: Improvement of image data Suppress unwanted distortions Highlight interesting features Image preprocessing does not increase the information content
1
2
3
position in the image
q = T(p)
4
5 [Matlab]
data format
image
6
Image can be made brighter or darker
7 [Matlab]
8
9
10
11
500 1000 1500 2000 2500 3000 50 100 150 200 250 200 400 600 800 1000 1200 1400 1600 1800 2000 50 100 150 200 250
[Matlab]
values and are therefore distinguishable
13
14
15 [Matlab]
– g(i,j)...original image (not distorted) – e(i,j)... distortion – f(i,j)... distorted images
constant color/grayvalue:
c c
c
16
new pixel value (spatial filtering)
– to suppress noise – image gets blurred – high frequencies vanish
– using local derivatives – Sharpening/Edge detection
17
noisy image
pixel and for every pixel a new value is computed as a linear combination of the filter kernel and the grayvalues of the local neighborhood.
18
W(-1,-1) W(-1,0) W(-1,1) W(0,-1) W(0,0) W(0,1) W(1,-1) W(1,0) W(1,1) f(x-1,y-1) f(x-1,y) f(x-1,y+1) f(x,y-1)
f(x,y)
f(x,y+1) f(x+1,y-1) f(x+1,y) f(x+1,y+1)
x y
mask
Mask coefficients Image section under mask
) , ( ) , ( ) , ( t y s x f t s w y x g
a a s b b t
19
f(x-1,y-1) f(x-1,y) f(x-1,y+1) f(x,y-1)
f(x,y)
f(x,y+1) f(x+1,y-1) f(x+1,y) f(x+1,y+1) 1/9 1/9 1/9 1/9 1/9 1/9 1/9 1/9 1/9
) 1 , 1 ( ... ) 1 , 1 ( ) , 1 ( ) 1 , 1 ( 9 1 ) , ( y x f y x f y x f y x f y x g
20
21
range.
– Clip values – Scaling transformation
L H L
New min New max 22
application of two simpler filters.
vectors.
– For a mask of size nxn, for each image pixel
23
change with distance.
values over small distances.
24
– 3x3 averaging filter to blur edges – Gaussian filter,
2 2 2
2 2
y x
25
border (according to the Gaussian distribution).
– as this parameter goes up, more pixels in the neighborhood are involved in “averaging”, – the image gets more blurred, and – noise is more effectively suppressed
26
which would require an infinitely large convolution mask.
the mean, and so we can truncate the mask at this point. Discrete approximation to Gaussian function with
0.1299 0.2793 0.3604 0.2793 0.1299 0.2793 0.6004 0.7748 0.6004 0.2793 0.3604 0.7748 1.0000 0.7748 0.3604 0.2793 0.6004 0.7748 0.6004 0.2793 0.1299 0.2793 0.3604 0.2793 0.1299
1299 0.2793 0.
27
with a 1-D Gaussian in the x direction, and then convolving with another 1-D Gaussian in the y direction.
0.3604 0.7748 1.0000 0.7748 0.3604
1299 0.2793 0.
28
29
is a high-pass filter, based on second derivatives.
frequency), application of the filter makes the gray values close to zero.
2
2
1
30
31
2 2 1 2
32
crispening or unsharp masking.
s
Sharpened image
s
Blurred image Original image Edge image
2
s
33
34
35
– e.g. sharpening with Laplace operator – The filter becomes
s
2 s
1 1 4 1 1 A h
36
37
neighborhood
suppressed)
38
image with noise averaging over 10 images
n k k
1
39
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 49 1 h
40
41
used for averaging
R j i R j i
, 2 , 2
42
Algorithm: for each pixel:
43
44
– Order the values under the mask – Trim off elements at either end of the ordered list – Take the mean of the remainder – E.g. assuming a 3x3 mask and the ordered list – Trimming of two elements at either end, the result of the filter is
9 3 2 1
7 6 5 4 3
45