Professional Documents
Culture Documents
2D convolution
A filter is a technique with which certain
frequency components can be chosen or
rejected
Convolution based filters use spatial mask
Spatial mask are also known as kernels,
templates and windows
The spatial mask is convolved with given image
to achieve the required smoothing or sharpening
effect.
Spatial Filtering
A spatial filter consists of (a) a neighborhood, and (b) a
predefined operation
a b
g ( x, y ) = w(s, t ) f ( x + s, y + t )
s =− a t =− b
m = 2a + 1; n = 2b + 1
Spatial Convolution
The convolution of a filter w( x, y ) of size m n
with an image f ( x, y ), denoted as w( x, y ) f ( x, y )
a b
w( x, y ) f ( x, y ) = w(s, t ) f ( x − s, y − t )
s =− a t =− b
Spatial Correlation
The correlation of a filter w( x, y ) of size m n
with an image f ( x, y ), denoted as w( x, y ) f ( x, y )
a b
w( x, y ) f ( x, y ) = w(s, t ) f ( x + s, y + t )
s =− a t =− b
2D convolution (kernel size: 3x3,
stride=1)
205 203
Shifting (stride =1)
X={1 2 3 4} m=4
Y={1 2 3 0} n=4
Zero padding