Chapter 5: Neighborhood Processing
description
Transcript of Chapter 5: Neighborhood Processing
![Page 1: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/1.jpg)
5-1
Chapter 5: Neighborhood Processing
Point processing: applies a function to each
pixel
Neighborhood processing: applies a function
to a neighborhood of each pixel
![Page 2: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/2.jpg)
5-2
○ Neighborhood (mask)
-- can have different shapes and sizes
![Page 3: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/3.jpg)
5-3
○ Function + Mask = Filter
Filter
Output signalInput signal
![Page 4: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/4.jpg)
5-4
2
2
( )
21( )
2
x x
g x e
11
( ) ( )2
/ 2 1/ 2
1( )
(2 ) | |
x-x x-x
xT
ng e
1D 2D
![Page 5: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/5.jpg)
5-5
◎ Linear filter: linear combination of the gray
values in the mask
![Page 6: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/6.jpg)
5-6
1 2
1 2
( , ) ( , ) ( , )
( 1, 2) ( 1, 2)
( 1, 1) ( 1, 1)
(1,2) ( 1, 2)
s t
p x y m s t p x s y t
m p x y
m p x y
m p x y
![Page 7: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/7.jpg)
5-7
。 Example
1( )
9a b c d e f g h i
![Page 8: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/8.jpg)
5-8
○ Processing near image boundaries
(a) Ignore the boundary(b) Pad with zeros(c) Copy boundary
○ Values outside the range 0-255
(a) Clip values(b) Scale values
![Page 9: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/9.jpg)
5-9
◎ Convolution 1 D : ( ) ( )
( ) ( )
f x g d
f g x d
![Page 10: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/10.jpg)
5-10
Discrete: ( , ) ( , )s t
f x s y t g s t
1 2
1 2
( , ) ( , )s t
p x s y t m s t
Linear filtering:
2 D: ( , ) ( , )f x y g d d
Compared with
![Page 11: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/11.jpg)
5-11
( ) ( ) ( ) ( )f x g d f g x d
◎ Correlation
![Page 12: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/12.jpg)
5-12
◎ Smoothing Filters
○ Averaging filters
Input 3X3 5X5 7X7
![Page 13: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/13.jpg)
5-13
○ Gaussian filters
(1-D):
(2-D):
2 2
222
1( , )
2
x y
g x y e
2
2
( )
21( )
2
x x
g x e
![Page 14: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/14.jpg)
5-14
Gaussian filters
Averaging filters
![Page 15: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/15.jpg)
5-15
○ Separable filters 1 2( , ) ( ) ( )f x y f x f y2 2 2 2
2 2 2
x y x y
e e e
1/9 1/9 1/9 1/3
1/9 1/9 1/9 1/3 [1/3 1/3 1/3]
1/9 1/9 1/9 1/3
1 2 1 1
2 4 2 2 [1 - 2 1]
1 2 1 1
Laplacian filter
e.g.,
![Page 16: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/16.jpg)
5-16
n × n filter:
2 (n × 1) filters: 2 multiplicationsn
2 multiplicationsn2 1 additionsn
2 2 additionsn
![Page 17: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/17.jpg)
5-17
Frequency domain filters:
![Page 18: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/18.jpg)
5-18
![Page 19: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/19.jpg)
3-19
( ) exp( )nn
f x c jn x
/ 2
/ 2
1( )exp( ) ,
T
n Tc f x jn x dx
T
0 01
, ( ) / 222 [ ], 2 [ ]
n n n
n e n n m n
c a c a jb
a R c b I c
01
( ) / 2 cos sinn nn
f x a a n x b n x
The relationships between their coefficients
can be written in complex form
where
![Page 20: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/20.jpg)
5-20
![Page 21: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/21.jpg)
5-21
![Page 22: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/22.jpg)
5-22
Frequency: a measure by which gray values change with distance
![Page 23: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/23.jpg)
5-23
High pass filter Low pass filter
High frequency components, e.g., edges, noises
Low frequency components, e.g., regions
Spatialdomain
Frequency domain
Fouriertransform
![Page 24: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/24.jpg)
5-24
High pass Low pass
Input image Fourier transform
![Page 25: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/25.jpg)
5-25
High pass filter e.g., LoG
1 2 1
2 4 2
1 2 1
1/9 1/9 1/9
1/9 1/9 1/9
1/9 1/9 1/9
○ In spatial domain
Low pass filtere.g., Averaging filter
Output
![Page 26: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/26.jpg)
5-26
◎ Edge Sharpening or Enhancement
○ Unsharp masking
![Page 27: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/27.jpg)
5-27
。 Idea of unsharp masking
(a) Edge
(b) Blurred edge
(a) – k × (b)
![Page 28: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/28.jpg)
5-28
。 Perform using a filter0 0 0 1/9 1/9 1/9
0 1 0 1/9 1/9 1/9
0 0 0 1/9 1/9 1/9
k
1 2
0 0 0 1/9 1/9 1/9
0 1 0 1/9 1/9 1/9
0 0 0 1/9 1/9 1/9
k k
。 Alternatives
(a)
(b) The averaging filter can be replaced with any low pass filters
![Page 29: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/29.jpg)
5-29
。 Example:
(a) Original (b) Unsharp Masking
![Page 30: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/30.jpg)
5-30
○ High-boost filter
high boost = A(original) – (low pass)
= A(original) – ((original) - (high pass)
= (A-1)(original) + (high pass)
。 Alternatives:
(a) (A/(A-1))(original) + (1/(A-1))((low pass)
(b) (A/(2A-1))(original) + ((1-A)/(2A-1))((low pass)
![Page 31: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/31.jpg)
5-31
。 Example:(a) (A/(A-1))(original) + (1/(A-1))((low pass)
(b) (A/(2A-1))(original) + ((1-A)/(2A-1))((low pass)
![Page 32: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/32.jpg)
5-32
◎ Non-linear smoothing filters
1 2 3 nx x x x ix
nx
: mask elements
。 Maximum filter:
1x。 Minimum filter:
![Page 33: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/33.jpg)
5-33
。 Median filter
。 K-nearest neighbors (K-NN)
。 Geometric mean filter
。 Alpha-trimmed mean filter
i) Order elements
ii) Trim off m end elements
iii) Take mean
1/| |
( , )
( , )M
i j M
x i j
1
( ) /( 2 )n m
i
i m
x n m
/ 2nx
![Page 34: Chapter 5: Neighborhood Processing](https://reader035.fdocuments.in/reader035/viewer/2022081504/568133e2550346895d9ad4cb/html5/thumbnails/34.jpg)
5-34
◎ Region of Interest Processing