SumitBirla.com

Assignment 2: Filters

Source code:


Sample pictures:

Original Smoothing 2D (3x3) Smoothing 2D (7x7)


Time taken by smoothing operations: The table below indicates the time taken by each implementation of the smoothing algorithm with different window sizes. The tests were run on 166 MHz Pentium and the picture used was lax.gif -

windowSize = -- 3 -- -- 5 -- -- 7 -- -- 9 --
One 2D (N x N) 280 ms 660 ms 1040 ms 1760 ms
Two 1D (N x 1) 220 ms 280 ms 330 ms 440 ms
Two incremental 1D (N x 1) 60 ms 60 ms 60 ms 50 ms


Analysis:

In the case of 2D smoothing, there is an exponential rise in the processing time when the window size is increased. This is because the average value (of grey) has to be calculated from an array whose size is proportional to the square of the window size. The processing time rises linearly in 1D smoothing and there is almost no increase in the time in incremental smoothing.

Median filtering is useful when there is a lot of noise in the picture. But is takes a long time since the array has to be sorted before the median can be found. The example below displays the striking improvement in the quality of the picture of Saturn and its moons. All noise is virtually removed

Smoothing is not as effective as Median Filtering at removing salt/pepper noise. It also blurs the image leading to a loss of information. The bigger the window size, the more the image blurs. This behaviour is shown below -

Note: The processed images are slightly smaller than the original because the Java Frame window does not display 100% of the image. Hence the captured image is smaller. I am working on fixing this problem.