Starting from:

$30

EE384-Lab5 Solved

Problem 1: Basic read and write images using Matlab

a)      Read and show the image lena.bmp (copy your code and the plot into your report).

b)      Convert the image into gray-scale using the Matlab’s built-in function rgb2gray.

c)      Write your own function my_rgb2gray to convert a RGB image to grayscale and test it on the lena.bmp image (show the image after being converted). Given that, for each pixel we have

𝑔𝑟𝑎𝑦 𝑠𝑐𝑎𝑙𝑒 𝑖𝑛𝑡𝑒𝑛𝑠𝑖𝑡𝑦 = 30% ∗ 𝑅 + 60% ∗ 𝐺 + 10% ∗ 𝐵

d)      Save the above gray-scale image to a file named lena_gray.jpg.

 

Problem 2: Histogram equalization (enhance the contrast of an image)

a)      Read and show the image lowcontrast.jpg.

b)      Show the histogram of the image using the function imhist.

c)      Using the function histeq to enhance contrast using histogram equalization, show the histogram and the image after enhancing.

 

Problem 3: Salt and pepper noise, median filter

a)      Add salt-and-pepper noise to the lena’s gray-scale image using the function imnoise. Assume that the noise density is 0.05 (read the function’s documentation for more information). Show the noisy image.

b)      Filter the noise using the function medfilt2 with the 3x3 window, show the filtered image.

c)      Filter the noise with the 5x5 window and show the filtered image; compare the filtered image to that of 3b). What happen when we increase the window size in the median filter?

More products