1 Image Enhancement (Spatial Domain Filters) Spatial Domain • Spatial Filtering – (As opposed to frequency domain filter) – For linear filters • Foundation based on the convolution theorem – g(x,y) = h(x,y)*f(x,y) – G(u,v) = H(u,v)F(u,v) • Goal is to either remove, or isolate frequencies in the image • Types – Linear – Non-linear
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
1
Image Enhancement(Spatial Domain Filters)
Spatial Domain• Spatial Filtering
– (As opposed to frequency domain filter)– For linear filters
• Foundation based on the convolution theorem– g(x,y) = h(x,y)*f(x,y)– G(u,v) = H(u,v)F(u,v)
• Goal is to either remove, or isolate frequencies in the image
• Types– Linear– Non-linear
2
Response of a linear mask
R = w1z1 + w2z2 + w3z3 ... + w9z9
Where wi are mask coefficients and zi are pixelintensities.
• Neighborhood operators– Convolution
Spatial Filtering using a Mask
Response of a linear mask, R, 9
R = ( w1z1 + w2z2 + w3z3 ... + w9z9) = ∑ wizi1
f(x,y) is centered around “z5” so g(x,y) = R =filter_about*f(x,y)
z1 z2 z3z4 z5 z6z7 z8 z9
w1 w2 w3w4 w5 w6w7 w8 w9
3
Smoothing Filters
• Smoothing Filters– blurring
• “pre-processing”– removal of small details before object extraction
– noise reduction• removal of noise in an image
• Often called “Low-Pass” Filters– Filter lets low-frequencies pass – Stops high-frequencies
Low-pass spatial filtering
Frequency Domain Spatial Domain
0 0
1
4
Low-pass spatial filtering
w1 w2 w3w4 w5 w6w7 w8 w9
•We can build a gaussian filter
•But, only requirement fora low-pass filter is that wi be positive
•Note, that the result can belarger than the valid output range(L-1)
•Can pre-scale the filter
scale_factor = (Σ wi )-1
Low-pass spatial filter
1 1 11 1 11 1 1
1/9 *
Average Filter
1 1 11 1 11 1 1
1/9 *
5
Extends to larger filters
1 1 11 1 11 1 1
1/9 *
1 1 11 1 11 1 1
1 1 11 1 11 1 1
1 1 11 1 11 1 1
1 1 11 1 11 1 1
1 1 11 1 11 1 1
1 1 11 1 11 1 1
1 1 11 1 11 1 1
1 1 11 1 11 1 1
1 1 11 1 11 1 1
1/81 *
Example
original n=5 (nxn mask)
n=25 (nxn mask)n=15 (nxn mask)
6
Other arrangements
1 1 1
1 2 1
1 1 1
Gaussian1111112321134311232111111
Weighted
Remember that the resulting gray-levelsmay be out of the range of the original image.
Isotropic Gaussian Filter
2
22
222
1),( σ
πσ
yx
eyxG+
−=
2D Gaussian distributionwith mean (0,0) and σ=1
7
Computing a discrete gaussian mask
2
22
222
1),( σ
πσ
yx
eyxG+
−=
2 10
-1-2
210-1-2
Center the Mask at (0,0). So, a 5x5 mask would compute values by at:
Use G(x,y) to computevalues for mask.
Often scaled by Max-GrayLevel; ie, 255*G(x,y)
Computing a discrete gaussian mask2
22
222
1),( σ
πσ
yx
eyxG+
−=
8
Linear vs. Non-linear• “Convolution”/Linear Filters
– Linear operation– Have corresponding frequency domain filter
• Non-linear Filters– Mask used to determine the proper substitution
of a “good” pixel value– Examine neighbors using various orderings
• Often use Rank or Order Statistics – Harder to interpret effect in frequency domain
Selected Smoothing
• (non-linear filter)• kth nearest neighbors
2 3 8
3 10
4 2 9
Find the kth nearest neighborsof (x,y) in a neighborhood nxn