Apply histogram-specification method to achieve contrast enhancement.
-
HS operation can be customized in the section(2) in the program file for other purpose & utilization
-
In this study, to enhance the contrast of the input picture, the parameters of histogram are self-defined as:
Program | function |
---|---|
HS_BW.m |
HS operation toward Black & White image |
HS_RGB.m |
HS operation toward RGB image |
HS_func.m |
function call by HS_RGB.m |
- Calculate the PDF and CDF of original data
- According to the desired histogram, construct the customized PDF and CDF
- With the two CDFs, we could build the mapping between input and output via
- Utilize the mapping function and the original data to obtain the output data
- Export those new pixels as an image
-
original and output histograms (after HS operation)
From the two pictures below, we could directly find that the output histogram is parser than the original histogram. Apart from that, we could also discover that more pixels concentrate near zero gray level in the output histogram than in the original one, which would probably make the dark area darker. Additionally, the increase of pixels also take place around 200~250 gray level, revealing that the bright area would possibly become brighter. I suppose that the effects are closely associated with the desired histogram.
-
Image after HS operation
From the desired histogram, we could discover that it has a tendency to make the bright area much brighter and the dark region darker. The distribution of intermediate color is relatively lower. As a consequence, the scheme would lead to a higher contrast in the processed picture. -
Table of transformation function to show the mapping from the input gray level r to the output gray level z
-
In the table, the green columns represent the corresponding gray level for each input (0~255). It is obvious that some numbers are lost in the sequence in the green columns, which reflects the result of the sparser histogram.
To further discuss the Transformation function, we could plot the above figure.(x-axis : input, y-axis : output). Apparently, we could discover that the part in the frame with red dotted line is upper than the diagonal line, which would make the color within the range brighter than before. Adversely, the part in the blue frame would let the color in the range become darker.