Ranking filter

from Wikipedia, the free encyclopedia

The ranking filters belong to the class of non-linear filters in digital image processing. These are filters that cannot be described by a convolution .

With the ranking filters, the gray values ​​of the pixels are collected in a defined area around a pixel, sorted by size and ranked . Now a gray value is selected from this sorted list that replaces the gray value of the current pixel.

The choice of position determines the type of ranking filter. With an ascending sorting you get the

  • Minimum filter, for the minimum gray value, first position in the list
  • Median filter, for the gray value in the middle of the list
  • Maximum filter, for the maximum gray value, last position in the list.

Minimum filter

With the minimum filter, the gray values ​​of the pixels are collected in a defined area around a pixel and sorted according to size. Now the smallest gray value of this sorted list is selected; this replaces the gray value of the current pixel.

 

Filtering white areas (see text)

The example on the right shows the automatic filtering of white text. The left part of the picture is provided with white lettering. The result of the automatic filtering can be seen in the middle picture, on the right as a three-fold enlargement.

The minimum filter replaces the values ​​of an environment with the smallest value of the environment. If the environment is sufficiently large, here 5 × 5 pixels, it contains not only the maximum values ​​for the white color of the font but also smaller gray or color values. The smaller values ​​replace the white. So that the entire picture does not run as in the demo pictures above, a threshold value filter was also inserted in order to leave pixel values ​​darker than white unchanged.

Median filter

Median image filtering of an image with white interfering pixels
Median filtering (right) of an image of Mars (left) from 1976 by Viking 1 from the Cydonia region

With the median filter, the gray values ​​of the pixels are collected in a defined area around a pixel and sorted according to size. Now the mean gray value ( median ) of this sorted list is selected; this replaces the gray value of the current pixel.

Compared to box filters, median filters have the advantage that individual pixels are replaced without smoothing the edges .

The left image of the upper photo pair is overlaid with statistically distributed white pixels. A median filter leads to the result on the right. Although no additional information has been added about the subject, the image on the right is easier to see. The white pixels create many contrast jumps and hinder image perception in the brain. If they are replaced by color values ​​from their surroundings, the result is a slightly blurred image with no unrelated edges. The outlier pixels (here white ( Salt )) are also called Salt and Pepper .

The lower pair of photos shows the result of a median filtering (block size: 5 pixels) on a Mars image from 1976, which is interspersed with dark pixels.

Here is an example of the difference between median filter and mean value calculation:

The median of {1, 3, 5 , 8, 103} = 5, on the other hand, the mean of {1, 3, 5 , 8, 103} = 24

This clear difference makes it easy to see that the median filter is much more stable against “outliers” in the image. The mean value filter would include these outliers in the new color value and thus falsify it.

The median filter shows clear weaknesses in writing. Black text would no longer be displayed on a white background, since most of the surrounding pixels are white. A 3 × 3 median filter omits all “lines” that are smaller than 2 pixels wide. A 9x9 median filter even leaves out all “lines” that are less than 5 pixels wide.

In the case of multi-channel images (color images), it does not necessarily make sense to apply the median filter to all channels separately and then to merge the channels. This generally creates new colors that can distort the image. One way to get around this problem is to use the vector median filter .

Maximum filter

With the maximum filter, the gray values ​​of the pixels are collected in a defined area around a pixel and sorted according to size. Now the largest gray value of this sorted list is selected, this replaces the gray value of the current pixel.

Individual evidence

  1. ^ Wilhelm Burger and Mark James Burge. Digital Image Processing: An Algorithmic Introduction Using Java. Springer Vieweg, Berlin, 3 edition, 2015.