How to Perform Contrast Enhancement Using Histogram Equalization in MATLAB?
Image enhancement is a manner to enhance the appearance of photographs/images to human viewers or to image processing device performance. Image Enhancement strategies may be categorized into classes as spatial area and frequency area. There are 5 image enhancement algorithms in the spatial domain the usage of FPGA technology.
These algorithms are as follows:
- Median filter
- Contrast stretching
- Histogram equalization
- Negative image transformation
- Power-law transformation
There are a few reasons that caused the want of enhancement:
- Bad quality of the used imaging device,
- Lack of information of the operator
- The unfavorable external conditions or environmental conditions at the time of capture.
There are two ways for Image Enhancement:
- Noise Removal
- Contrast enhancement
In this article, we will see Contrast enhancement using histogram equalization. Histogram Equalization is a mathematical technique to widen the dynamic range of the histogram. Sometimes the histogram is spanned over a short-range.
- Find the frequency of each value represented on the horizontal axis of the histogram i.e. intensity in the case of an image.
- Calculate the probability density function for each intensity value.
- After finding the PDF, calculate the cumulative density function for each intensity’s frequency.
- The CDF value is in the range 0-1, so we multiply all CDF values by the largest value of intensity i.e. 255.
- Round off the final values to integer values.
- imread( ) is in-built function used to read the image.
- size( ) is in-built function used to get the size of image.
- rgb2gray( ) is in-built function used to convert RGB image into grayscale image.
- zeros(row, col) is in-built function used to create row*col matrix of zeros.
- unit8( ) is in-built function used to convert double value into integer format.
- imshow( ) is in-built function used to display image.
- title( ) is in-built function used to attach title to the image.
- pause( ) is in-built function used to pause the system to execute next statements.
Histogram equalization is a great approach for image enhancement. It offers a better quality of images without a lack of any information. This method applies histogram equalization globally. We can also apply this method in small blocks of the image in order to enhance the contrast. That technique is called Adaptive Histogram Equalisation. AHE is more efficient than simple HE.