Anda di halaman 1dari 6

Spatial Filtering

&
Frequency Domain Image
Enhancement

Sankalp Kallakuri
elsanky@gmail.com
Spatial Filtering
• Involves moving a kernel over the image to enhance the
image
• Kernel size is << Image size
• Odd sized masks are more common
Spatial Filtering
m(-1,-1) m(0,-1) m(1,-1)

f(x-1,y-1) f(x,y-1) f(x+1,y-1)


m(-1,0) m(0,0) m(1,0)

f(x-1,y) f(x,y) f(x+1,y) m(-1,1) m(0,1) m(1,1)

f(x-1,y+1) f(x,y+1) f(x+1,y+1)


Mask coefficients

Image pixels under mask

R = m(-1,-1) f(x-1,y-1) + m(0,-1) f(x,y-1) + m(1,-1) f(x+1,y-1) + ………..


a b
g ( x, y)    m(s, t ) f ( x  s, y  t )
s   at   b
Spatial Filtering
• The operation is similar to Convolution. hence the masks are also
called convolution masks.

• Non linear operations such as finding median may also be done on


a neighborhood.

• Near the edges parts of the masks may lie beyond the image
boundary.

• To avoid this either a smaller filtered image is accepted.

• Or zeros are padded along the image boundary.


Smoothing Spatial Filters
• Averaging or Low pass filters.
• Used to remove unwanted detail.
• Smooth out unwanted sharp noise transitions.
• May smooth out edges which should be sharp.

Examples

Box filter Weighted Average

1 1 1 1 2 1
1/9 x 1 1 1 1/16 x 2 4 2
1 1 1 1 2 1
Smoothing Spatial Filters

• The box filter does a simple average.


• The weighted average filter weighs the contribution by the
distance from the central image pixel.
Original Mathematical expression
a b

  m( s , t ) f ( x  s , y  t )
g ( x, y )  s   at   b
a b

  m( s , t )
s   at   b

3 6 9 12

Anda mungkin juga menyukai