Starting from:
$30

$24

COM-SGN.110-EXERCISE 7

The tasks should be completed and presented to TA during the lab session. Do not forget to upload your solutions to Moodle! Questions about exercises should be addressed to the TA personally, through Moodle messages or via email, which can be found on the Moodle page of the course.




1. Noise generation and restoration




Load ‘lena.jpg’ and separately add the following noises to it:




Gaussian noise (Hint: Use imnoise function)



Salt & pepper noise (Hint: Use imnoise function)



Rayleigh noise:



If there are multiple independent Gaussian random variables, the magnitude of their combination will follow the Rayleigh distribution. For example: if the image is taken in complex domain and has independent instances of Gaussian noise in both its real part and its imaginary part, the magnitude image will have a Rayleigh noise component.
MATLAB: noise = sqrt(-b*log((1-rand(height,width))



Add the generated noise to the image to obtain the noisy image.



Select the noise parameters so that image quality deterioration is noticeable, and the image quality is approximately the same in each case.




2. Restoration of Noisy Images




Filter the image using the filters described below. Use 5x5 as the filter size. Present your resulting images in four 2-by-2 subplots. The first subplot contains the original image and three types of noisy images. From the second to the fourth subplot, you should have the noisy image of one type on the top left and images filtered with different filters in the other positions.




Arithmetic mean filter:









MATLAB: f = imfilter(g,fspecial('average',[m n]));




Geometric mean filter:
    














MATLAB:

f = exp(imfilter(log(g),ones(m,n),'replicate')).^(1/(m*n))




(Note: log(a*b*c…) = log(a) + log(b) + log(c) + ...)




c) Harmonic mean filter:

   








MATLAB:

f = (m*n) ./ imfilter(1 ./ (g + eps), ones(m, n), 'replicate');




Which filtering method is the most suitable for each specific type of the noise? Describe the effects of the filters on each noisy image.










3. Noise cleaning with Weighted Median Filter




An extension of median filter, which we learned last week, is the weighted median filter (WMF). Besides having the same strengths such as edge preserving and removing the impulse noise, WMF has a better detail preserving property over the original median filter1. In this exercise, we implement a simple WMF and identify its strengths.




Load lena.jpg and add salt and pepper noise with a variance of 0.02.



Implement the WMF with a window of 5 by 5. The output of weighted median is presented in the equation below, where ◊ is denotes the duplication operator.
    



































Fill the center of weight kernel with 5 and keep the rest with 1.




Show the original image, noisy image, original median filtered image and the one by WMF in a 2-by-2 subplot.

























































*More details can be found in Yang, et al., “Optimal Weighted Median Filtering Under Structural Constraints”, IEEE Transactions on Signal Processing, 1994.

More products