Euclidean Distance Filter for Image Processing

This paper introduces Euclidean distance filter as a new method for image filtering. It discuses conceptual aspects of the filter and implements examples to illustrate it's application.


Introduction
Image filters have been used and known for many years and their application is evidence of their importance in enhancing, edge detection and noise reduction of images. These filters are examined and analysed both in time and frequency domains.
General framework of image filters is mathematical calculations, especially probabilistic methods, on pixel values. Geometrical filters are missing components of image processing and as today, these is no analysis and contribution in this area. The key concept of geometrical filters is considering geometrical position of each pixel respect to a defined coordinate. In this way each pixel has both pixel value and weight. This weight can be defined by geometrical concepts. As an example, in Euclidean distance filter, every pixel's weight is a function of its Euclidean distance from centre of the filter. In this way, each pixel's weight within the filter range contributes in determining pixel value locating in centre of the area that the filter is applied.

Methodology
Euclidean distance filter is a rectangular filter where value of each block is its Euclidean distance from centre of the filter. It is assumed that position of each filter's block can be pointed by x-y coordinates, where (0,0) coordinate is position of centre block of the filter. Filter value at each block can be shown by F(x,y). Figure 1 illustrates these concepts. Figure a is a is a 9*9 filter and it shows position of each filter's block in x-y coordinate and its value F(x,y). As a result, each block's value is its Euclidean distance from centre of the filter, which is calculated inside filter's block in Figure b.  Figure 2 illustrates method of applying Euclidean filter to an image. The right shape is specific area of an image that Euclidean distance filter is applying. Figure a is a rectangle area of that image and each pixel is coordinated respect to center of the filter, resulting having of X(x,y). Figure b is a 9*9 filter consisting of its values and the multiplication (*) is applied element-wise. The result of applying the filter on pixel values, is a 9*9 block consisting of product of each pixel value and its Euclidean distance from centre of the filter. For calculating pixel value that is coincided with center of the filter, which in this case is pixel (0,0), these products can be summed up and averaged.

Figure 2: Multiplication of pixel values(left) with filter values (right)
In order to reduce noise of an image and eliminate sharp areas, inverse value of Euclidean distance can be used, i.e., as the pixel is further away from center of the filter, it's contribution in calculating pixel value that coincide with center of the filter is decreased. Mathematics of calculating filter's values is illustrated as below: where ( , ) is Euclidean distance of each filter's block from center of the filter, ( , ) is inverse of Euclidean distance for noise reduction and smoothing, and is contribution factor of center of the filter. As increases contribution of center of the filter increases and result picture is more similar to original one. On the other hand, if decreases, center's contribution decrease and the result picture will become more smoothed. Filter values, ( , ), are normalized values of ( , ). In this way output pixel value ( , ) is calculated using equation below: where * is element-wise product of filter ( , ) and input pixel ( , ).  Figure 3 and Figure 4 illustrate effect of applying Euclidean distance filter to an original image that is implemented in Euclidean distance filter implementation (2021). To both images, a 5*5 filter is applied, and as it shows, sharp areas of pictures are smoothed. As the size of filter increases, more neighbour pixels are contributing in calculation of pixel value, and as expected, the picture will become more smoothed. Figure 5 illustrates this concept.

Results
a b c d Figure 5 : Comparing original image(a) and applying 5*5 filter(b), 10*10 filter(c), and 15*15 filter(d). As expected, the picture gets more smoothed as size of filter increases.
For evaluation of importance of gamma , we apply a 10*10 filter with different values. Picture 6 illustrates effect of values on performance of the filter. As increases, importance of center block of the filter increases and, as result, calculation of pixel value coordinated in center of the filter is heavily biased with this block, resulting of having a picture more similar to original one. a b c d Figure 6: Comparing original image(a) and applying filter with gamma=0 (b), gamma=10 (c), and gamma=100 (d). As expected, the picture gets more sharper as gamma increases.