Description

This is a very basic operation, it looks many entries, but in fact there is only 4 questions and 1 intro, which each of them is not difficult. You need to follow each step according to the requirements carefully. The only thing is to pay attention to explain in words what you do at each step. Please don’t forget to write a note at each step of why you did it. Here are some demo codes, you can refer to them if you need.

Lab 2 Practice Work: Spatial Digital Filtering

July 29, 2019

Task 2.1

Download any gray-scale image or any RGB image and convert it to grayscale.

1) Determine the type of noise in the image.

2) If the image is noisy enough, you can skip this. Else try adding gaussian

noise to the image.

3) Apply a 3×3 median filtering to the noise grayscale image.

4) Apply a 3×3 smooth filtering to the noisy grayscale image.

5) Give your interpretation between the (3) and (4).

6) Apply a 3×3 Laplacian filtering to a grayscale image.

Try to construct the kernels for (a) and (b) and compare your results with the

MATLAB inbuilt functions.

Task 2.2

Download any image from the internet.

1) Apply a 3×3 averaging kernel to the image.

2) Increase the kernel size and convolve the image. Keep increasing the kernel

size and interprete the results. Also plot the time it takes to execute the

convolution as a function of the kernel size.

3) Repeat 1) and 2) using a kernel of your choice which you think better

enhance or remove the noise as compared to the averaging kernel. Compare

the execution time as a function of kernel size as well.

Task 2.3

Use any image of your choice and

1) Apply ‘prewitt’ and ‘sobel’ filter to the image. Compare the two outputs. 2)

Flip the kernel by 90 degrees by transposition and apply the filter again.

Task 2.4

Read an image using imread.

1) Add Gaussian noise with zero mean and 0.1 variance to the image.

2) Write a loop that iteratively generated a noisy image, adds it to the original

image and creates a sum image. Use 10 iterations. Calculate the average

image and display it.

3) Repeat 2) for 50, 100, 1000 iterations and compare the images.

Task 3.1

Use the PDF files ‘fpecial.pdf’, ‘imfilter.pdf’, ‘imnoise.pdf’, ’Noise

Removal.pdf’ to do this part

1) Down Load 4 Images from the ‘Imaging Modalities’ Document. You may pick

the ones you like. Two of these images should be color and two black and

white. Once you download them use the MATLAB function “imread” to read

them into the matrices

‘im1,im2,im3,im4’ in MATLAB

e.g. im1 = imread(‘leaves.jpg’)

2) Use the ‘size’ matalb function to determine if your image is color (3D) or black

and white

(2D)

e.g. s = size(im1)

3) Use the color images you downloaded to learn how to convert between various

color spaces and examine the resulting images using the MATLAB functions

that you learned in Home work for scaling image values from 0 to 1. In

particular learn how to use the functions ‘rgb2lab’, rgb2xyz’,’rgb2ycbcr’ and

their reverse functions (e.g. lab2rgb, etc…)

4) Use the MATLAB function ‘fspecial’ to apply various smoothing and

sharpening filter to the Y components of the color images and convert back to

RGB to examine the result of the filters.

5) Use the MATLAB function ‘imnoise’ to add noise to the black and white

images and directly to the black and white images. Add Gaussian and salt &

pepper noise.

6) Use averaging filter to remove the Gaussian noise and median filter to remove

the salt&pepper noise.

7) Use the ‘simple-nlm.m’ MATLAB function and and ‘demo1.pdf’ as an

example to denoise the Gaussian noise and compare with the averaging

method. For nl-mean use the same values for all input variables as in the

demo1 example but vary the variable ‘h2’

8) Use Gray-world and Scale-by-max methods to color balance the

‘BlueImage.jpg’ and ‘RedImage.jpg’ you can download from Piazza

Purchase answer to see full

attachment