

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Chapter 2 Problems 2.15, 2.16, 2.17, Chapter 3 Problems 3.4, 3. Programming assignment In this MATLAB assignment, we shall study the effect of histogram equalization and how it can be implemented with a piecewise linear transformation of the pixel values. The original image is lena.gif. Plot its histogram using the imhist command in MATLAB. Then, consider the darkened version of the image, called daklena.gif. Again, plot its histogram using the imhist function and comment on the histogram difference between the 2 images. For the 2 gif images, see class website www.ece.ucsb.edu/ ~ manj/ece178. Then, use the histogram equalization command in MATLAB, called histeq, on the darklena.gif image. Comment on the image quality obtained after the histogram equalization and comment on its histogram, with respect to the histograms obtained from lena.gif and darklena.gif. Now, we shall study the effect of using an appropriate piecewise linear transformation to the pixel values. The logic is as follows: say, we provide 2 vectors a = [ a 1 ; a 2 ; a 3 ; a 4 ] and b = [ b 1 ; b 2 ; b 3 ; b 4 ] as input. Then, as showed in Fig. 1, the region [ a 1 , a 2 ] is mapped to [ b 1 , b 2 ], the region [ a 2 , a 3 ] is mapped to [ b 2 , b 3 ] and the region [ a 3 , a 4 ] gets mapped to [ b 3 , b 4 ]. You have to choose a proper set of values for a = [ a 1 ; a 2 ; a 3 ; a 4 ] and b = [ b 1 ; b 2 ; b 3 ; b 4 ] and then use them to perform piecewise linear transformation of the pixel values.
Your MATLAB routine should take the darklena.gif image and a and b as inputs, and the output should be the image, with piecewise linear transformation performed. Using Fig. 1 as the reference, you should use vectors a and b, each of length 4, and set a 1 = 0, a 4 =1, b 1 = 0 and b 4 = 1. Then, you should intelligently choose a 2 ; a 3 ; b 2 and b 3 , so that the perceptual quality of the image obtained after piecewise linear transformation is good. The pseudocode is as follows: