CS7966 Image Processing

Project 1: Contrast Enhancement

Saurav Basu
email: sbasu@cs.utah.edu



Files Submitted
Source Files: Executables: Images: Report:
  1. gammaCorrect.cxx
  2. gammaCorrect_main.cxx
  3. histEq.cxx
  4. histEq_main.cxx
  5. aHistEq.cxx
  6. aHistEq_main.cxx
  7. cLAHistEq.cxx
  8. cLAHistEq_main.cxx
  1. gammaCorrect
  2. histEq
  3. aHistEq
  4. cLAHistEq
*.png under the
images directory
index.html


Executing the Programs
Executable Usage
gammaCorrect gammaCorrect inputimage gamma_lo gamma_hi num_gammas
This creates the gamma corrected images in the same directory
as the inputimage by postfixing the name with the parameters
example:
gammaCorrect images/xinwei1.png 1 2 2
Creates the files: images/xinwei1.png_gammac_1,2 etc. in the images directory .
histEq histEq inputimage blending_factor
This creates the histogram equalized image in the same directory
as the inputimage by postfixing the name with the blending_factor
example:
histEq images/xinwei1.png 0.6
Creates the files: images/xinwei1.png_HE_0.6 etc. in the images directory .
aHistEq aHistEq inputimage numtilesX numtilesY
This creates the Adaptive histogram equalized image in the same directory
as the inputimage by postfixing the name with the tile sizes
example:
aHistEq images/xinwei1.png 4 4
Creates the files: images/xinwei1.png_AHE_4_4 etc. in the images directory .
cLAHistEq cLAHistEq inputimage numtilesX numtilesY
This creates the Contrast Limited Adaptive histogram equalized image in the same directory
as the inputimage by postfixing the name with the tile sizes and slope value
example:
cLAHistEq images/xinwei1.png 4 4 2
Creates the files: images/xinwei1.png_CLAHE_4_4_2 etc. in the images directory .


Answers to Questions and Discussion
  1. GAMMA CORRECTION
  2. Question: Find good gamma values for the given images and discuss efficacy of the aproach?

    Answer:

    Image Good Gamma
    Values (approx.)
    xinwei1.tif 2.25
    seeds.jpg 1.75
    family.tif 1.75

    The images below show the result of applying gamma correction to these 3 images with different values of gamma.
    Original Image (xinwei1.png) Gamma=2.25 Gamma=1.75 Gamma=2.75
    Original Image (seeds.png) Gamma=1.0 Gamma=1.75 Gamma=2.0
    Original Image (family.png) Gamma=1.75 Gamma=1.5 Gamma=2.0

    Efficacy of Gamma Correction: Gamma Correction increases the overall brightness of the images by adjusting for the non linearity of voltage intensity graph of CRT monitiors. It performs well in restoring the originally captured signal for some images. However the correct value of gamma used for gamma correction would depend on the gamma value of the monitor being used for viewing the images.For the seeds.jpg image gamma Correction does not seem to do too well. It should be coupled with contrast stretching techniques to further enhance image quality.


  3. HISTOGRAM EQUALIZATION
  4. Question: Implement Hisogram equalization on the given images, experiment with different blending factors and discuss effectiveness for each image.

    Answer:
    The table below shows the histogram equalized images with blending factors (0-1)

    Blending factor 1: Blending factor 0.75 Blending factor 0.5 Blending factor 0.25 Blending factor 0 (Histogram Equalized Image)
    Blending factor 1: Blending factor 0.75 Blending factor 0.5 Blending factor 0.25 Blending factor 0 (Histogram Equalized Image)
    Blending factor 1: Blending factor 0.75 Blending factor 0.5 Blending factor 0.25 Blending factor 0 (Histogram Equalized Image)
    Blending factor 1: Blending factor 0.75 Blending factor 0.5 Blending factor 0.25 Blending factor 0 (Histogram Equalized Image)
    Blending factor 1: Blending factor 0.75 Blending factor 0.5 Blending factor 0.25 Blending factor 0 (Histogram Equalized Image)
    Blending factor 1: Blending factor 0.75 Blending factor 0.5 Blending factor 0.25 Blending factor 0 (Histogram Equalized Image)
    image effectiveness
    xinwei1 Not very effective since the subject occupies a small region of the whole image and Histogram Equalization only favors intensities which occupy large areas.
    xinwei2 Pretty effective with a blending factor of 0.5. Without blending pure Histogram equalization makes the image grainy due to excessive jump in intensities.
    seeds Pretty effective Histogram equaized images are much clearer with details easily discernable.
    family Pretty effective: Incresases the ability to distinguish detail and certainly enhances image quality.
    capitol Partially effective: Pure histogram equalization makes parts of the image darker and introduces artifacts, does ok with a blending factor of 0.75
    portal Effective: Increases the contrast and makes small changes in intensity more easily perceptible by increasing the contrast.

  5. ADAPTIVE HISTOGRAM EQUALIZATION
  6. Question: Implement Adaptive Hisogram equalization on the given images, experiment with different window sizes.

    Answer:
    The table below shows the histogram equalized images with different tile sizes.

    2x2 tiles 4x4 tiles 16x8 tiles
    2x2 tiles 4x4 tiles 8x8 tiles
    2x2 tiles 4x4 tiles 8x8 tiles
    2x2 tiles 4x4 tiles 8x8 tiles
    2x2 tiles 4x4 tiles 8x8 tiles
    2x2 tiles 4x4 tiles 8x8 tiles

    Question: Discuss time it takes to run

    Answer:
    The programs take approximately the same amount (1-2secs) on the school of computing lab machines except for family.tif which takes slihgtly longer because of the larger image file.There is overhead of additionally performing the bilinear interpolation between the histograms but it only increases the complexity by a constant term.

    Question: Discuss its effectiveness.

    Answer:

    image effectiveness
    xinwei1 Partially effective: It has managed to make the subject's face much more clear but it has also introduced a lot of random noise.
    xinwei2 Same as above: Better image but lot of noise too..
    seeds At 8x8 noise starts to dominate.Pretty good upto 4x4
    family Pretty effective: At 4x4 we can easily make out how local histogram equalization increases the contrast much more than a global histogram equalization.
    capitol Quite good: At 8x8 the capitol image is much clearer but there is a lot of noise introduced as well.
    portal Quite Effective:But above 4x4 too much noise(Not too much to gain by Adaptive Historam Equalization) .


    Question: Comment/Explain artifacts.

    Answer:
    AdaptiveHistogram Equalization introduces a lot of noise , spikes in intensity. This is probabl due to the sudden change in area occupied by a pixel of a particular intensity in the different windows used for building he histogram. Allmost all images show this noise which increases as we reduce window size (increase tile size).


  7. CONTRAST LIMITED ADAPTIVE HISTOGRAM EQUALIZATION
  8. Question: Describe the method for CLAHE in a paragraph.

    Answer:
    The idea behind CLAHE is to prevent the random noise introduced during local Histogram Equalization by limiting the maximum slope of the greyscale transform function. The slope of the cumulative distribution function is determined by the bin counts. If a bin has a large count , it will result in more slope. By thresholding (clipping) the maximum histogram count we can ensure a limit on the slope. The aproach used in the cLAHistEq program is to clip histograms exceeding the threshold and redistribute the excess evenly among all the remaining bins. Slope value used in the program should be greater to ensure more contrast. Smaller slope will limit the contrast more and hence serve to reduce noise.

    Question: Experiment CLAHE with different slope values .Comment on effectiveness

    Answer:
    The table below shows CLAHE applied with different slopes and Tile sizes.

    18x8 tiles slope= 15 18x8 tiles slope= 5 18x8 tiles slope= 2
    8x8 tiles slope =15 8x8 tiles slope =10 8x8 tiles slope =5
    8x8 tiles slope =15 8x8 tiles slope =10 8x8 tiles slope =5
    4x4 tiles slope =15 4x4 tiles slope =10 4x4 tiles slope =5
    4x4 tiles slope=15 4x4 tiles slope=10 4x4 tiles slope=5
    4x4 tiles slope=15 4x4 tiles slope=10 4x4 tiles slope=5
    image effectiveness
    xinwei1 Yes,CLAHE has removed the noise present in AHE and also enhanced the contrast.The face of the subject is much clearer now.
    xinwei2 Yes, an appropriate choice of tile size and slope was able to imrove contrast and remove noise effectively.
    seeds Yes, same as above.
    family Yes, compared to the same images using only AHE we can clearly see a reduction in noise.
    capitol Same as above
    portal Yes, but i am not sure of what features exactly to look for in this case.