ENEE 631 Homework #2

Daniel Garcia-Romero (dgromero.at.umd.edu)

                                                                                                                                                                                          

 

 

Part 1. Histogram stretching and equalization

 

§         In the first part of the homework only the luminance information of the image has been used. Two Matlab functions have been coded to perform histogram stretching and equalization:

 

o       Histogram stretching function: histogram_streching_threshold.m

o       Histogram equalization function: histogram_equalization.m

 

§         A Matlab script with the optimum configuration of each of these two functions, for each original image, has been created:

 

o       Script with the optimum parameters for the original images: script_hw_2.m

 

§         Whereas the equalization function does not need to be adjusted (only takes the input image), the stretching function takes four extra parameters. Figure 1 shows the configurations selected for the two images. The optimum set of parameters was selected by the subjective visual quality. It is interesting to note that the stretching function takes into account the MIN and MAX values of the input image to improve the overall dynamic range of the output.

 

(a)

(b)

 

 

Figure 1. (a) Stretching function for image clouds.jpg (b) Stretching function for image caves.jpg

 

§         Figure 2 shows the results of the histogram stretching and equalization for the two images:

 

(a)

(b)

(c)

(d)

(e)

(f)

 

Figure 2. (a,c,e) Original, stretched and equalized histogram of image clouds.jpg. (b,d,f) Original, stretched and equalized histogram of image caves.jpg

 

§         The resulting images after the enhancement are shown in figure 3:

 

(a)

 

(b)

(c)

 

(d)

(e)

 

(f)

 

Figure 3. (a,c,e) Original, stretched and equalized image “caves.jpg”. (b,d,f) Original, stretched and equalized image “clouds.jpg”.

(Note that the size of the presented images has been reduced for display purposes)

 

§         The processed images in (768 x 1024) size are available in the links bellow:

 

o       Caves luminance original: caves_lum_original.jpg

o       Caves luminance stretched: caves_lum_streched.jpg

o       Caves luminance equalized: caves_lum_equalized.jpg

 

o       Clouds luminance original: clouds_lum_original.jpg

o       Clouds luminance stretched: clouds_lum_streched.jpg

o       Clouds luminance equalized: clouds_lum_equalized.jpg

 

§         As a conclusion we can see that the histogram equalization does not produce a good aesthetic image enhancement. On the other hand, the histogram stretching produces a better looking image but requires manual adjustment, so it is more and “art” than a science.

 

 

Part 2. Color image contrast enhancement:

 

§         In this section we are going to perform a color image contrast enhancement. The Matlab code generated for this process is available in the following link:

 

o       Color contrast enhancement script: script_color.m

 

§         The idea used in the algorithm is very simple. Since we are concerned with the aesthetic image enhancement, we expect the color transformation to leave hues unchanged, to make small changes to the saturation and to affect mostly the intensity. To carry out that simple idea, we create an intensity image by selecting the maximum value of the [r,g,b] vector for each pixel:

 

I(x,y)=max[r(x,y), g(x,y), b(x,y)]

 

§         Then we process the intensity information with the histogram stretching function developed in Part 1, and use the ratio of the output I’(x,y) to the input I(x,y) to scale each color component:

 

r’(x,y) = [I’(x,y)/ I(x,y)] * r(x,y)

 

g’(x,y) = [I’(x,y)/ I(x,y)] * g(x,y)

 

b’(x,y) = [I’(x,y)/ I(x,y)] * b(x,y)

 

§         Figure 4 shows the results for the two images:

 

(a)

(b)

 

(c)

(d)

 

 

Figure 4. (a,b) Original and stretched image “caves.jpg”. (c,d) Original and stretched image “clouds.jpg”.

(Note that the size of the presented images has been reduced for display purposes)

 

§         The processed images in (768 x 1024) size are available in the links bellow:

 

o       Caves color original: caves.jpg

o       Caves color stretched: caves_color_streched.jpg

 

o       Clouds color original: clouds.jpg

o       Clouds color stretched: clouds_color_streched.jpg

 

§         As a conclusion we can see that by applying a very simple normalization to the color components, based on the intensity information, we can improve the contrast of the color images.