Image Processing Reference
In-Depth Information
the median operator which has demonstrated capability to reduce noise whilst retaining
feature boundaries (in contrast to smoothing which blurs both noise and the boundaries),
and the mode operator which can be viewed as optimal for a number of noise sources,
including Rayleigh noise , but is very difficult to determine for small, discrete, populations.
3.5.2
Median filter
The median is another frequently used statistic; the median is the centre of a rank-ordered
distribution. The median is usually taken from a template centred on the point of interest.
Given the arrangement of pixels in Figure 3.19 (a), the pixel values are arranged into a
vector format, Figure 3.19 (b). The vector is then sorted into ascending order, Figure 3.19 (c).
The median is the central component of the sorted vector, this is the fifth component since
we have nine values.
287
243805767
406
357
(a) 3 ×
3 template
(b) Unsorted vector
023456778
Median
(c) Sorted vector, giving median
Figure 3.19
Finding the median from a 3 ×
3 template
The median operator is usually implemented using a template, here we shall consider a
3 × 3 template. Accordingly, we need to process the nine pixels in a template centred on a
point with co-ordinates ( x , y ). In a Mathcad implementation, these nine points can be
extracted into vector format using the operator unsorted in Code 3.10 . This requires an
integer pointer to nine values, x1 . The modulus operator is then used to ensure that the
correct nine values are extracted.
x1 := 0..8
unsorted :=p
x1
x1
3
x+mod(x1,3)-1,x+floor
-1
Code 3.10
Reformatting a neighbourhood into a vector
We then arrange the nine pixels, within the template, in ascending order using the
Mathcad sort function, Code 3.11 :
This gives the rank ordered list and the median is the central component of the sorted
vector, in this case the fifth component, Code 3.12 .
Search WWH ::




Custom Search