6.3 Image Operation Based on Spatial Neighbourhoods
6.3.1 Window-based image smoothing, Low - pass filters
1. Averaging with equal weightsThe last filter can be used to remove drop-out lines in Landsat images. This is done by applying a filter only along the drop-out lines in those images.
![]()
We can also use 5x5, 7x7, etc. This filter is also called a box-car filter.
2. Averaging with different weights
3. Median filterThis filter is more useful in removing outliers, random noise, and speckles on RADAR imagery, than a simple average filter. It has a desirable effect of keeping edges to some extent. This filter can also be applied to drop-out line removal in some Landsat images.
If we denote an image window in the following form:
The average filter in 1 can be written as
By moving (i, j) all over an image, the original image, I, can be filtered and the new image, I', can be created.
6.3.2 Window-based edge enhancement - High-pass filtersFor 2,![]()
In order to enhance edges, differences between neighbourhood digital numbers are taken. We will start from one dimensional example:
1 1 1 1 : 2 2 2 2 IBy taking I(i+1) - I(i) , we get![]()
<> edge
0 0 0 1 0 0 0 I'We suppressed all the non-change part and left the edge out and thus an enhancement can be achieved. We can apply the differencing technique again to I', to get I''
0 0 1 -1 0 0 I"I" = I'(i+1) - I'(i) = I(i+2) - I(i+1) - I(i+1) + I(i)
= I(i+2) - 2I(i+1) + I(i)
The advantage of using a second order differencing is that we can locate exact position of the edge at the zero-crossing point.1 -2 1 are the weights
We call the first differencing, taking
a gradient
and the second differencing, taking a
.
We can use the matrix
1 -2 1 as a Laplacian filter, an edge enhancement filter.In the two-dimension form, a Laplacian filter is:
Another form can be:
Sobel filter - spatial derivative6.3.3 Contrast stretching through high-frequency enhancement
![]()
This is also called edge-enhancement by subtractive smoothing
6.3.4 Linear Line Detection Templates![]()
![]()
Why we don't use
This contrast will not be as good as DN-KDN".
The question is, can we write DN-kDN" in a filter form? The answer is yes.
![]()
With 5 x 5 filters we can have more directions ex.
![]()
![]()