EE440 Assignment 2 -Histogram and cumulative distribution function of histogram Solved

1.  Histogram and cumulative distribution function of histogram.  

For this problem, use the Lena image, 2_1.bmp. Keep the range of the pixel values in [0,255]. The histogram of a digital image with gray levels in the range [0,L-1] is a discrete function h(k)=Nk, where Nk is the number of pixels in the image having gray level k. Write your own program to plot the histogram and the cumulative distribution function (cdf) of the pixel values of Lenna image. (Normalize the histogram to get the probability density function (pdf) and make sure it sums to one.)

 

Hint: This image contains three identical bands of size MxN. After loading the image, use one of the bands to plot the histogram. DO NOT use imhist or hist. You need to write your own code to plot the histogram.

 

2.  Show (a) the three R, G, B images, and (b) the three H, S, V images of 2_2.bmp. (35 points)

 

Hint: To read in the image use: X=imread(‘2_2.bmp’,’bmp’). Notice that X will be a three dimensional array. You can then use rgb2hsv to convert the image to HSV.


3.  Write your own Matlab program (do not use commercial image editing tools) to produce the negative of the 2_1.bmp image. (35 points)


Hint: The negative of an image = (2^n – I)-1, where n is the number of bits and I is the intensity value of a pixel on this image.