Image Processing and Visual Denoising Report

Exclusively available on Available only on IvyPanda® Written by Human No AI

Introduction

This paper examines various types of noise that could be introduced to digital images during its production. This noise can be a big challenge to the producer of these images for they drastically lower the visual quality of the affected images. Gaussian noise and Salt n Pepper noise have been featured as they are believed to be the most common types of noise. Filtering techniques have also been discussed in which case mean, median and wiener filter have been considered. In case of mean filtering technique both arithmetic and geometric mean have been discussed in details. The various parameters of noise image including the mean, variance and the density have been seen to greatly affect the visual quality of the output and therefore their particular effect has been analysed comprehensively by changing the parameter and comparing the results. The effect of change on the window size on the final image has also been featured where 3 x 3, 5 x 5 and 7 x 7 windows were treated separately.

For successful execution of the task some customized MATLAB functions have been used. Other self designed codes have also been used wherever necessary in displaying output images as well as in specifying filter windows.

Random Noise Generation

Here both Gaussian noise and Salt n Pepper noise are observed as they are the most common varieties of noise in the digital media. In both cases, the noisy image with all its parameters is introduced to the original image by use of MATLAB’s “imnoise” function. In an attempt to investigate the output in this procedure Gaussian noise was used as an input in one of the samples while salt n pepper was used in the remaining sample. Both types of noise were introduced into the original image through a randomized distribution in which case, the mean and the variance of the Gaussian noise were provided as the input to the “imnoise” function. The image used with the Gaussian noise was as shown in Figure 1.

Input Image.
Fig 1:- Input Image.

Different values of the variables of the Gaussian noise, that is, both the mean and the variance were used and the resultant noisy image was as shown in the following figure. Initially, the mean of the Gaussian nose was fixed at 0.0 as the variance was varied along a predetermined scale after which the variance was fixed and the resultant image observed as the mean was changed.

Noisy Image with Gaussian noise of mean 0 and variance 0.01.
Fig 2:- Noisy Image with Gaussian noise of mean 0 and variance 0.01.
Noisy Image with Gaussian noise of mean 0 and variance 0.1.
Fig 3:- Noisy Image with Gaussian noise of mean 0 and variance 0.1.
Noisy Image with Gaussian noise of mean 0 and variance 0.2.
Fig 4:- Noisy Image with Gaussian noise of mean 0 and variance 0.2.
Noisy Image with Gaussian noise of mean 0 and variance 0.5.
Fig 5:- Noisy Image with Gaussian noise of mean 0 and variance 0.5.

In all the cases considered and shown above, the introduction of the noise was done by initially maintaining the mean at 0.0 while the variance was changed alternately from 0.01, 0.1, 0.2 and 0.5. It was observed that as the variance of the noise signal was increased the visual quality of the resultant image decreased making it more and more difficult to identify the various features of the image. As it can be seen from the images the variance of 0.01 gave a resulting image where tiny details of the image were still within clear visual clarity. However, as the variance of the Gaussian noise was varied towards greater variance values, more features of the image including the more conspicuous ones became more blurred.

In the second image test, the variance of the noise was maintained at a fixed value 0f 0.01 while the mean changed alternately from 0.1, 0.2 and 0.5. The subsequent figures show the resultant images.

Noisy Image with Gaussian noise of mean 0.1 and variance 0.01.
Fig 6:- Noisy Image with Gaussian noise of mean 0.1 and variance 0.01.
Noisy Image with Gaussian noise of mean 0.2 and variance 0.01.
Fig 7:- Noisy Image with Gaussian noise of mean 0.2 and variance 0.01.
Noisy Image with Gaussian noise of mean 0.5 and variance 0.01.
Fig 8:- Noisy Image with Gaussian noise of mean 0.5 and variance 0.01.

In the above figures, it can be observed that the higher values of mean raise the brightness of the image. A closer look at the second image reveals that visual quality aspect of the white features of the image found on the left side becomes fainter and with a mean of 0.5 none of these white features are observable whereas the black features have become brighter. It can therefore be concluded that an increase in the variance of the Gaussian noise results to an increase in noisy features in the image effectively reducing the visual quality of the resultant image. In the other hand, higher mean values of the Gaussian noise have been seen to raise the brightness of the resultant image.

Code Segment for Gaussian Noise Images

Im=imread(‘img04.jpg’); %reads the image

figure

imshow(Im) % displays the image

Im2=imnoise(Im,’gaussian’,0,0.01); %using imnoise with gaussian noise, mean=0 amd variance=0.01

figure

imshow(Im2)

Im2=imnoise(Im,’gaussian’,0,0.1);

figure

imshow(Im2)

Im2=imnoise(Im,’gaussian’,0,0.2);

figure

imshow(Im2)

Im2=imnoise(Im,’gaussian’,0,0.5);

figure

imshow(Im2)

Im2=imnoise(Im,’gaussian’,0.1,0.01);

figure

imshow(Im2)

Im2=imnoise(Im,’gaussian’,0.2,0.01);

figure

imshow(Im2)

Im2=imnoise(Im,’gaussian’,0.5,0.01);

figure

imshow(Im2)

Next the Salt n Pepper noise was introduced onto an original image by use of “imnoise” function to investigate its effect on the visual quality of the image. In this case the density “d” of the noise was taken as the variable for which different values were used to determine the extent to which the pixels of the original image would be distorted by the noise. For instance when Salt n Pepper noise with a density of 0.1 is introduced to an image then 10% of the pixels would be distorted. As the name suggests, Salt n Pepper noise constitutes of white (salt) and black (pepper) pixels and care must be taken to ensure that their probability at the introduction to the image are maintained the same.

In the following figures the original image is shown alongside three other noisy images in which Salt n Pepper noise has been introduced with the value of “d” being varied from 0.1, 0.2 and 0.5.

Input Image.
Fig 9:- Input Image.
Noisy Image with Salt n Pepper noise with d=0.1.
Fig 10:- Noisy Image with Salt n Pepper noise with d=0.1.
Noisy Image with Salt n Pepper noise with d=0.2.
Fig 11:- Noisy Image with Salt n Pepper noise with d=0.2.
Noisy Image with Salt n Pepper noise with d=0.3.
Fig 12:- Noisy Image with Salt n Pepper noise with d=0.3.

It was observed that varying “d” caused equivalent variations in the amount of pixels distorted by the introduced noise. In this case, due to the noise introduced to the image with the resultants as shown in the above figures the pixel distortion was 10%, 20% and 50% respectively.

Code Segment for Salt n Pepper Noise Images

Im=imread(‘img05.jpg’);

figure

imshow(Im)

Im2=imnoise(Im,’salt & pepper’,0.1); %using imnoise with salt n pepper noise, d=0.1

figure

imshow(Im2)

Im2=imnoise(Im,’salt & pepper’,0.2);

figure

imshow(Im2)

Im2=imnoise(Im,’salt & pepper’,0.5);

figure

imshow(Im2)

Image De-noising by Mean Filters

Here, Gaussian randomized noise was introduced to an original image to give rise to a noisy image. The appended noise was then removed by use of arithmetic and geometric mean filters. In the activity, the visual quality of the de-noised image was observed and comparison was made by varying the mean filter from arithmetic to geometric and the effect of changing the window size from 3 x 3 to 5 x 5 was also noted.

The figures below shows the original image and the blurred image after introducing random Gaussian noise with a mean of 0.0 and a variance of 0.2.

Input Image.
Fig 13:- Input Image.
Noisy Image with Gaussian Noise of 0 mean and 0.2 Variance.
Fig 14:- Noisy Image with Gaussian Noise of 0 mean and 0.2 Variance.

To ensure that both the 3 x 3 and 5 x 5 image windows perform well as expected, a padding exercise was performed on the noise image by use of MATLAB and the resulting images are as shown below. In this case arithmetic mean filtration was employed with the first image using a 3 x 3 window whereas a 5 x 5 window was used for the second.

Filtered Image with Arithmetic Mean Filter of 3x3 window.
Fig 15:- Filtered Image with Arithmetic Mean Filter of 3×3 window.
Filtered Image with Arithmetic Mean Filter of 5x5 window.
Fig 16:- Filtered Image with Arithmetic Mean Filter of 5×5 window.

It was observed that the filtration by use of mean filters did not give a very good product though the image produced by use of the 5 x 5 window was smoother than that produced using the 3 x 3 window. However, the nice looking 5 x 5 image has most of its black features brightened up, but the features can still be observed from the image produced by use of the 3 x 3 window.

The following figures reveal what happens when geometric filter is used to de-noise the image by use of both 3 x 3 and 5 x 5 windows. In this case the 3 x 3 window was observed to produce better visual quality image than those produced using the 5 x 5 window. The large size of the 5 x 5 window was seen to perpetuate a tendency where the filtration process over-smoothed the image causing an impression of residual noise on the black features of the image.

Comparing both arithmetic and geometric image features, it was observed that geometric mean filters gave rise to images of better visual quality when compared to those produced by arithmetic mean filters. Geometric filtration process was also able to recover the black elements of the image better than the when arithmetic process was used. This was the case when each of the two window sizes was used.

Filtered Image with Geometic Mean Filter of 3x3 window.
Fig 17:- Filtered Image with Geometic Mean Filter of 3×3 window.
Filtered Image with Geometic Mean Filter of 5x5 window.
Fig 18:- Filtered Image with Geometic Mean Filter of 5×5 window.

Code Segment for Arithmetic and Geometric Filtering of Size 3×3

for i=2:sz(1)

for j=2:sz(2)

block=[I3(i-1,j-1) I3(i-1,j) I3(i-1,j+1);… % getting the pixel values in 3×3 window

I3(i,j-1) I3(i,j) I3(i,j+1);…

I3(i+1,j-1) I3(i+1,j) I3(i+1,j+1) ];

I3a(i-1,j-1)=mean(mean((block))); % calculating the mean of 3×3 window i.e. arithmeteic mean filter

I3g(i-1,j-1)=geomean(geomean((block))); % calculating the mean of 3×3 window i.e. geometric mean filter

end

end

Code Segment for Arithmetic and Geometric Filtering of Size 5×5

for i=3:sz(1) % doing the same thing but this time for 5×5 window arithmetic and geometric mean filters

for j=3:sz(2)

block=[I5(i-2,j-2) I5(i-2,j-1) I5(i-2,j) I5(i-2,j+1) I5(i-2,j+2);…

I5(i-1,j-2) I5(i-1,j-1) I5(i-1,j) I5(i-1,j+1) I5(i-1,j+2);…

I5(i,j-2) I5(i,j-1) I5(i,j) I5(i,j+1) I5(i,j+2);…

I5(i+1,j-2) I5(i+1,j-1) I5(i+1,j) I5(i+1,j+1) I5(i+1,j+2);…

I5(i+2,j-2) I5(i+2,j-1) I5(i+2,j) I5(i+2,j+1) I5(i+2,j+2)];

I5a(i-2,j-2)=mean(mean((block)));

I5g(i-2,j-2)=geomean(geomean((block)));

end

end

Image De-nosing by Median Filter

This section of the paper examines median filtration by considering different sizes of the window to establish its net effect on the resultant image. The image shown below was contaminated by Salt n Pepper noise and the effort to remove the noise was done by use of 3 x 3, 5 x 5 and 7 x 7 median filters. The noise introduced had a probability of 0.2 and therefore 20% of the pixels were expected to have been distorted through the process.

Input Image.
Fig 19:- Input Image.
Noisy Image with Salt n Pepper Noise of 0.2 probability.
Fig 20:- Noisy Image with Salt n Pepper Noise of 0.2 probability.
Filtered Image with Meadian Filter of 3x3 window.
Fig 21:- Filtered Image with Meadian Filter of 3×3 window.
Filtered Image with Meadian Filter of 5x5 window.
Fig 22:- Filtered Image with Meadian Filter of 5×5 window.
Filtered Image with Meadian Filter of 7x7 window.
Fig 23:- Filtered Image with Meadian Filter of 7×7 window.

From the experiment it was observed that the 3 x 3 window produced the best visual quality image though some traces of pepper could still be visible. In case of the 5 x 5 window, the resultant image was outstanding but there was a small problem in smoothing up of the image. The 7 x 7 window in the other hand managed to restore a top quality image but with over-smoothed features that led to compromise in the image colours like it can be seen with the 3-pins located at top side of the image. The 7 x 7 window also treated the features that were smaller in size than its block as part of the noise a fact that resulted in having a lower visual quality in the final image. A good example in this is the 8-dots seen around the white circular feature appearing in the top side of the image.

Considering these results, a 5 x 5 window was opted as the most suitable to offer the most optimized output because of its ability to give a more balanced output that has neither over-smoothed features nor excessive traces irremovable noise.

Code Listing for Image De-nosing

I=imread(‘img04.jpg’); %reading the image

figure

imshow(I) % displaying the image

I2=imnoise(I,’salt & pepper’,0.2); % introducing salt n pepper using imnoise

figure

imshow(I2) % showing th noise image

I3=medfilt2(I2,[3 3]); % using median filter with the window size 3×3

figure

imshow(I3)

I5=medfilt2(I2,[5 5]); % using median filter with the window size 5×5

figure

imshow(I5)

I5=medfilt2(I2,[7 7]); % using median filter with the window size 7×7

figure

imshow(I5)

De-blurring by Wiener Filter

In this last section of the paper, noise was introduced to an original digital image and removed using the Wiener filter by use of MATLAB’s specialized function called “deconvwnr”. The result for this experiment is shown by the figure below.

 Input Image.
Fig 24: Input Image.
Blurred Image.
Fig 25:- Blurred Image.
Filtered Image with Wiener Filter.
Fig 26:- Filtered Image with Wiener Filter.

It is observable from the output image that the boundaries have become deeper while at the same time the black colour becomes lighter including the shady colour of “D” from the original image. The output image reveals that wiener filter completely recovers the black features of the image. However the white shade in the background could not be recovered as the entire background was turned greyish.

Code Listing for Image De-blurring

a=0.1; % setting a, b and T to the given values

b=0.1;

T=1;

Im=imread(‘img05.jpg’); % reading the image

H=zeros(3,3);

for u=1:3

for v=1:3

temp=u*a+v*b;

H(u,v)=T/(pi*(temp))*sin(pi*(temp))*exp(-1i*pi*temp); % making the blur filter using the given formula

end

end

figure

imshow(Im) % input image displayed

Im2=imfilter(Im,H); % using the blur filter to blur the image using the imfilter function of matlab

figure

imshow(real(Im2)) % showing the blurred image

Im3=deconvwnr(real(Im2),real(H),0); % using the wiener filter to deblur the image as directed in the assignment

figure

imshow(Im3) % deblurred image

Conclusion

It has been established that the size of window affects the output of de-noised image differently in both arithmetic and geometric mean filter as well as in all other filtering techniques. In addition, it has been found that the visual quality of a de-noised image significantly depends on the value of the noise parameters used. The choice of the type of filter to use is also important depending on the type of noise that is to be removed from the original digital image. In all cases, de-noising of the image was successful albeit difference in visual quality was noted.

References

Digital Image Processing, Second Edition, Rafael C. Gonzalez and Richard E. Woods.

Digital Video Image Quality and Perceptual Coding, H. R. Wu and K. R. Rao.

More related papers Related Essay Examples
Cite This paper
You're welcome to use this sample in your assignment. Be sure to cite it correctly

Reference

IvyPanda. (2022, March 17). Image Processing and Visual Denoising. https://ivypanda.com/essays/image-processing-and-visual-denoising/

Work Cited

"Image Processing and Visual Denoising." IvyPanda, 17 Mar. 2022, ivypanda.com/essays/image-processing-and-visual-denoising/.

References

IvyPanda. (2022) 'Image Processing and Visual Denoising'. 17 March.

References

IvyPanda. 2022. "Image Processing and Visual Denoising." March 17, 2022. https://ivypanda.com/essays/image-processing-and-visual-denoising/.

1. IvyPanda. "Image Processing and Visual Denoising." March 17, 2022. https://ivypanda.com/essays/image-processing-and-visual-denoising/.


Bibliography


IvyPanda. "Image Processing and Visual Denoising." March 17, 2022. https://ivypanda.com/essays/image-processing-and-visual-denoising/.

If, for any reason, you believe that this content should not be published on our website, you can request its removal.
Updated:
This academic paper example has been carefully picked, checked and refined by our editorial team.
No AI was involved: only quilified experts contributed.
You are free to use it for the following purposes:
  • To find inspiration for your paper and overcome writer’s block
  • As a source of information (ensure proper referencing)
  • As a template for you assignment
1 / 1