Order Now

Lab Report


The purpose of this lab is to explore the possibilities of filtering of spatial domains of images. The filtering will be performed using median filter, moving average and kernel convolution. The software used for image filtering in this lab is IDL.

Exercise 1.

1.1. Moving average

On these three images (Fig. 1.1-1.3, the first image on the left is the initial image of the fork. The second image on each of these figures is the result of adding noise to this image; this operation transformed the images and reduced their contrast and resolution. On every third image on Fig. 1.1-1.3, smoothing with different span was applied to the previous image (the result of adding noise). The third image on Fig. 1.1 was smoothed using span 5; as a result, the resolution of this image has decreased and it is hard to identify smaller details on this image. On Fig. 1.2, span 8 was used for smoothing; the resolution has decreased more notably than on Fig. 1.1, and the image became blurred. On Fig. 1.3, the span of the image was increased to 15, so the resulting image is very blurred, the resolution is very low, and most image details were lost or blurred. Therefore, applying smoothing to the images leads to the decrease of resolution, image blurring and makes it difficult to identify image details. The larger span is used, the more intensive these effects are.

1.2. Moving average with edge truncate 



Figures 1.4 – 1.9 include three parts: on the leftmost part, the initial image is shown; in the middle, the image after adding noise 100 to it is shown, and on the rightmost part the image after applying smoothing with different span values and with/without edge truncate is shown.

As it can be seen on Fig. 1.4 – 1.9, adding noise resulted in lowering the resolution of the image. The rightmost parts of Fig. 1.4, 1.6 and 1.8 show the effect of smoothing the image with noise, using span 5, span 30 and span 40, along with edge truncate function. These transformation had the following effect on the image: the image became blurred and the intensity of blurring increased along with the increase of span, the details of the image became less visible, and the transformation reached the edges of the image due to edge truncate function.

On Fig. 1.5, 1.7 and 1.9 it is shown how the initial image was changed by applying noise 100, and then how the image transformed after applying smoothing with span 5, span 30 and span 40 without edge truncate function. The transformation blurred the image and reduced its resolution in the middle, but did not affect the edges of the image.


Exercise 2.

2.1. Median filter

Figure 2.1. Initial image        noise 3000                              mav 5                          med 5

On Fig. 2.1, the leftmost image is the initial image. The image next to it is the result of applying noise 3000; this transformation adds the “salted” effect to the image. On the next image (third from the left) moving average filter with span 5 was applied; this transformation blurred the image and led to the decrease of resolution. The rightmost image on Fig. 2.1 was obtained by applying median filter. The image became significantly clearer even compared to the initial image: the lines on the background which are present on the initial image were removed, and median filter also corrected the blurring resulting from moving average filter. The resolution of the last image increased. These effects took place because in the process of median filter the software determined median average value of gray areas located close to each other, therefore balancing the gray level.

2.2. Different median filters


On Fig. 2.2-2.4, the initial photo of bits was first transformed using noise 30000 and then moving average filter was applied. Three different spans – 5, 10 and 15 – were used for moving average filter on Fig. 2.2, 2.3 and 2.4 accordingly. The initial image is the leftmost on Fig. 2.2-2.4, the image with noise applied is located next to it, and the image after applying moving average filter is the third from the left. It is possible to see that the use of moving average filter blurred the image, the resolution of the image was lowered, and the details of the image became hardly recognizable. As the span of moving average filter increases, these effects are more intensive.

The rightmost image on Fig. 2.2-2.4 shows the results of using median filter with different span – 5, 10 and 15. On Fig. 2.2, the use of median filter increased the sharpness of the image and removed blurring, so the image became clearer; however, the use of median filter with span 5 added some grain to the image. Fig. 2.3 shows that median filter with span 10 makes the resolution of the image higher (compared to the previous image); this filter removed the blurring from the middle of the image, but the edges still became grainy. On Fig. 2.4, median filter with span 15 was used; one can see that the resolution of this image is higher and the image is clearer compared to Fig. 2.2 and 2.3, blurring was removed, and there are no grains in the middle of the image (only some grains close to the edges).

Therefore, it is possible to conclude that the effect of median filter is better than that of the moving average filter: the moving average filter adds blurring and reduces the image’s resolution so it is difficult to identify the details of the image, while median filter improves the resolution of the image, makes it more smooth and clear.

2.3. The use of median filter does not increase the image’s noise and the value of the picture’s strength.

2.4. Median filter


Figure 2.6. Initial X-Ray image        noise 30000                mav 10                        med 10

Figure 2.7. Initial X-Ray image        noise 30000                mav 15                        med 15

This exercise illustrates the use of median filter similarly to section 2 of exercise 2 in this paper. Instead of a picture of bits the image obtained from X-Ray is used. Noise 30000 was applied to the initial image; after that, moving average filter and then median filter with the same span were applied to the image. The spans were 5 for Fig. 2.5, 10 for Fig. 2.6 and 15 for Fig. 2.7. It is possible to see that median filter is better compared to the moving average filter because it does not blur the image, restores the image’s details and removes noise; with the increase of median filter span, the proportion of grainy areas decreases.


Exercise 3. 

3.1. Kernel filter

Figure 3.1. Initial image        noise                           moving average                      kernel

On Fig. 3.1, the results of applying noise to the initial image, and then the use of moving average filter and kernel filter with span 5 are shown. In this case, the image after using moving average filter is not significantly blurred, and the lower half of the image resembles the initial image. However, the top part of the image is not similar to the initial image. After the use of kernel filter, the effect is the opposite: the top part of the image resembles that of the initial image, and the bottom part is different from the initial image. Moth moving average filter and kernel filter did not significantly affect small details of the initial image, and it is possible to identify image details.