Take the average of the nine pixels and assign it to the pixel in consideration.
(ii) Median Filtering
Sort the neighborhood pixel in value, take the midpoint value in the list as the new value for the center pixel.
(iii) Gauss Filtering
Calculate the gaussian weight matrix, take the weighted average of the neighborhood pixel and assign it to the pixel in consideration.
(iv) Contrast-dependent outlier removal
Calculate the average and variation of the neighborhood pixel. If the value of the pixel has large deviation compared to its neighbor, replace it with the average, else remains unchanged.
(v) k-Nearest Neighbour filtering
Sort the neighborhood pixel in value, take the average of the nearest k value in the list and assign it to the pixel.
(vi) Midrange Filtering
Sort the neighborhood pixel in value, take the average of the largest and smallest value in the list as the new value of the pixel.
step 2 based on different filtering
Set a threshold for the elements in H(u,v) below which it is set to 1.0, then do pixel by pixel operation F(u,v)=G(u,v)/H(u,v)
(ii) Inverse Filtering(Frequency Cuff-off)
Set a threshold for frequency above which the values related to these frequencies are set to 1.0, then do pixel by pixel operation F(u,v)=G(u,v)/H(u,v)
(iii) Wiener Filter
Add a constant and do pixel by pixel operation(H(u,v) is conjugate of H(u,v)) F(u,v)=H(u,v)*G(u,v)/(|H(u,v)|*|H(u,v)|+constant*Sn(u,v)/Sf(u,v))
(iv) Power Spectrum Filter
Estimate the noise power spectrum Sf(u,v) based
on knowledge of the noise added to the image, obtain the power spectrum
Sn(u,v) of the original(no blur, no noise) image(both
are unrealistic since the original image is not known and the knowledge
about noise is quite limited), do pixel by pixel operation F(u,v)=Sqrt(Sf(u,v)/(|H(u,v)|*|H(u,v)|*Sf(u,v)+constant*Sn(u,v))*G(u,v)
Implement the Laplacian operator in frequency domain to get P(u,v), do pixel by pixel operation F(u,v)=H(u,v)*G(u,v)/(|H(u,v)|*|H(u,v)|+constant*|P(u,v)|*|P(u,v)|)
step 3 use the inverse FFT to get
the restored image F(u,v)-->f(x,y)
Generally, Median Filtering and k-Nearest Neighbor Filtering when k is 6 are the best two methods. We can compare the worse noisy images after filtering with those before filtering. Fig.1 (a) is the noise image. Fig. 1(b) and Fig. 1(c) are the filtered images using the Median Filtering and k-Nearest Neighbor Filtering when k is 6 respectively. It seems that Midrange Filtering is not a good filter. Fig. 1(d) shows its effect. O/F RMS means the RMS errors between the original image and the filtered image. Fig. 2(a) to Fig. 2(d) are another group of images. The noise image is taken from the salt pepper noise image with noise ratio equal to 0.2.



Figure 1 (a)Gaussian noise with deviation=21,
(b)
Median filter (O/F RMS = 12.5)
(c) k-Nearest filter (O/F RMS=10.2),
(d) Midrange filter
(O/F RMS=18.3)
Figure 2 (a) Salt-pepper noise with noise ratio 0.2, (b) Median filter (O/F RMS = 29.1),
(c) k-Nearest filter (O/F RMS=34.1), (d) Midrange filter (O/F RMS=72.9)



beta/alfa
5.0 10.0
20.0 40.0
50.0 100.0
RMS error N/F O/F N/F
O/F N/F O/F N/F
O/F N/F O/F N/F O/F
N/F
alfa=2
16.5 13.0 15.5 12.1 15.1 11.7
14.9 11.6 14.9 11.5 14.8 11.5



alfa
5.0 10.0
20.0 40.0
50.0 100.0
RMS error
N/F O/F N/F O/F N/F
O/F N/F O/F N/F O/F
N/F O/F
beta/alfa=50 14.9 11.5
9.0 11.6 6.5 12.5 5.0
13.2 4.2 13.8 3.5 14.1
Fig. 5(a) to Fig.5 (c) are the Gaussian Filtered images
with the constant ratio of beta to alfa (50) and alfa changes from 2 to
10 to 22 respectively.


For Contrast-dependent outlier removal filtering, the effect will be better with the increment of the threshold value. But this is not the law. For some noise, especially the salt pepper noise, the best effect is shown when it is beside 0.6, in the middle. Fig.6 (a) to Fig.6 (c) show the effect when the threshold is 0.2, 0.6 and 0.9 respectively.



For k-Nearest neighbor filtering, the effect when k=6 will be better
than that k=3. Again,this is not the law. For some noise, the best effect
is shown when k=3. Fig. 7(a) to Fig. 7(c) show the effect
when k=3 and 6 respectively. The noise is salt pepper with noise ratio
equal to 0.1.


Original Image:
The performance of the restoration algorithms was experimentally examined
using the following image.
Degradation Models:
Two types of artificial analytical blurring were added:
Furthermore, artificial gaussian white noise of zero mean and varying variance
was added to more closelt approximate a real life situation.
Parameters:
The noise was varied by using sigma values from the set {2, 4, 8, 16}.
For gaussian blurring, the amount of blurring was varied using sigma values
from the set {1, 2, 4, 8}. For motion, blurring lengths from the set {8,
16, 32, 64} where used. The degraded noisy images where restored by applying
the above methods varying the main restoration parameter for each method.
The range in which the parameter of the different restoration algorithms
was varied depended on the method:
The restoration experiment resultet in about 3200 images
It can be argued that the number of images would not have been neccessary but since disk space and CPU time was not a problem, there was no reason not to vary the parameters to this extend. The summary file, which can be found following this link, allows to efficiently get an overview of the results.
Results
Representative Example (noise with sigma=4 pixel):
In this example, noise with a sigma of 4 pixel was added to the degraded images. The two cases of Gaussian blurr and linear motion blurr are presented.
Gaussian blurr (sigma=2 pixel)
Degraded Images
_
Figure 9: (a) degraded image (Gaussian blurr of sigma=2)
(b) noise (sigma=4) added
Restored Images
Qualitative Analysis
1. Inverse Filtering (cut-off):
_
_
Figure 10: Ignoring values less than (a) 0.01 (b) 0.1 (c) 1.0
For low restoration parameters, image (a), only relatively small values in the response function are ignored. Therefore the noise term is amplified by a factor of 100 leading to the observed "grizzle". This "grizzle" decreases as the cut-off value increases (b). For even larger restoration parameters, image (c), so many points of the response function are masked out that the effective restoration is minimal. The restored image approaches the degraded image and the amount of restoration goes to zero.
2. Inverse Filtering (frequency cut-off):
_
_
For low cut-off values only the lowest frequencies are affected and the effective restoration is low. For high cut-offs, image (c), most frequencies are affected and the restoration approaches the above inverse filtering.
3. Wiener Filter:
_
_
The Wiener filtering is roughly invariant to variations of the restoration parameter. This raises the question whether the restoration parameter should have been varied to a greater extend. Theoretically a restoration of 1.0 gives the optimal Wiener Filter. While maybe not capturing the full potential of the parametric Wiener filter the results show that the Wiener Filter gives consistent results around its optimal restoration parameter. In addition, the Wiener Filter was together with the Constraint Least Square filter, one of the two best performing methods.
4. Power Spectrum Filter:
_
_
Figure 13: Factors of (a) 0.2 (b) 1.0 (c) 2.0
As above for the Wiener filter, little variation in the result could be observed for varying restoration parameters. The noise level of the power spectrum filter was very high throughout all blurring parameters and noise levels. This is probably due to the fact that a single noise sample (the actual noise sample that was added to the degraded image) was used. Estimating the noise power spectrum by averaging over several noise samples could potentially have given better results.
5. Constraint Least Square:
_
_
Figure 14: Factor of (a) 0.001 (b) 0.01 (c) 0.1
For the constraint least square algorithm, the restoration parameter can be considered as the weight given to the smoothness of the image. As it can be observed in the above images (a) through (c), the "smoothness" increases as the restoration parameter increases. The constrained least square method was one of the better performing methods for image restoration.
Motion (length=16 pixel)
The above experiments where repeated with linear motion degradation of length 16 pixel.
Degraded Image:
_
Restored Images:
For inverse filtering the same comments as above apply:
1. Inverse Filtering (ignoring small values in response function):
_
_
Figure 16: Ignoring values less than (a) 0.01 (b) 0.1 (c) 1.0
2. Inverse Filtering (frequency cut-off):
_
_
Figure 17: Ignoring freq. greater than (a) 10 (b) 40 (c) 80
3. Wiener Filtering:
_
_
Figure 18: Factors of (a) 0.2 (b) 1.0 (c) 2.0
Again it can be seen that the Wiener Filter is robust towards variation of the restoration parameter. Qualitatively smaller values tend to give better results.
4. Power Spectrum Filter:
_
_
Figure 19: Factor of (a) 0.2 (b) 1.0 (c) 2.0
As above for Gaussian blurr, the noise level in the results obtained using the power spectrum filter is large compared with the best images obtained by the other methods.
5. Constraint Least Square:
_
_
Figure 20: Factor of (a) 0.001 (b) 0.01 (c) 0.1
It can be observed that the smoothness in the image increases as the restoration parameter increases as above for Gaussian blurr. Although the noise level seems to be higher for smaller restoration parameters, image (a), the obtained result seems to be slightly better than for larger values.
RMS Errors between original image and restored images:
In the following table the root mean square difference between the restored images and the original undegraded, noise-free image are summarized to obtain a quantitative measure for the performance of the various restoration algorithms. A complete summary of all images created can be found here.
Method Defocus (sigma=4) Motion (len=16) Noise=4 Inverse Filter (cutoff) 0.01 0.1 1.0 0.01 0.1 1.0 parameters 54.49 18.92 24.06 99.96 22.61 49.61 rms error Inverse Filter (freq. cutoff) 10 40 80 10 40 80 parameters 24.00 19.41 19.77 37.81 21.99 23.99 rms error Wiener 0.2 1.0 2.0 0.2 1.0 2.0 parameters 18.24 20.70 18.72 18.13 19.25 18.53 rms error Power Spectrum 0.2 1.0 2.0 0.2 1.0 2.0 parameters 35.38 41.61 31.19 65.83 65.44 63.22 rms error Constr. Least Square 0.001 0.01 0.1 0.001 0.01 0.1 parameters 19.13 18.00 20.17 20.29 17.92 21.18 rms error
It can be seen that the constrained least square method gives the best results
in terms of the rms error. The power spectrum filter gives the worst results.
It is worth noting that the best method in terms of rms error does not necessarily
have to give the best qualitative results. A method might produce
few outliers in the restored image that are perceived to be negligible
compared to the overall quality of the image. However, the rms error "quality
measure" is sensitive towards outliers and can lead to an "unfairly" low
rating of the results. A good performance evaluation will involve both qualitative
and quantitative performance measures. Therfore two additional sets
of qualitative results (i.e., the actual images) are presented.
Representative Example: "Worst Case" (follow link for actual results)
The most difficult restoration task is the one with maximum degradation and highest noise level (noise with sigma=16 pixel, maximum blurring). This example gives an qualitative and quantitative impression of how the various methods perform in a very difficult restoration task. For compactness the images and rms errors are summarized in a table.
Gaussian Blurr:
It could be observed very clearly that all restoration methods struggle with this task. The high noise level makes a good restoration very difficult. An unbiased person that had no knowledge of the actual original image identfied the two trees in the image but did clearly not point out a sailboat. The Wiener filter, the inverse filter and the constrained least square filter all produced comparable results.
Motion:
The results for the motion degradation where clearly slightly better, although the degraded image did not appear to be less degraded than the images in the above case of gaussian blurr. Qualitatively the Wiener filter outperformed the other methods. With the constrained least square method a close second. This could also be observed in terms of the rms errors.
Representative Example "Best Case" (follow link for actual results)
The best case is considered to be the the one where the noise level is minimal. We choose to use maximum blurring in this example in order to show the performance of the various restoration algorithms under optimal conditions. The noise that was added to the degraded images has a variance corresponding to sigma=1.0 pixel.
Gaussian Blurr:
Compared to the "worst case", the results where better, but still far from the original image. All methods gave approximatelt comparable results with the exception of the power spectrum filter.
Motion:
Compared to the restoration of the gaussian blurring the restoration of
the motion degraded images is far better. Especially the Wiener
filter and the constrained least square method gave good results (subjectively
and in terms of rms error) and an unbiased person identified the trees,
the forest in the background and "guessed" a lake in the foreground.
Following is the comparison of different filters apply to the same level
of blurring and noise. For different type of Blurring and different noise,
the constrained least square filter and the wiener filter always work best.
The power spectrum filter is worst and with the inverse filter in between.
It's no surprise that as the level of blurring and noise increases, the
root mean square error increases too. But the presence of the noise plays
much important role here. At low level of noise, the difference between
various filters tends to diminish. while at high level of noise, the
difference is prominent.
Gauss Blurring(Noise Level=16)