How to Normalize a Histogram in MATLAB?
Histogram normalization is a technique to distribute the frequencies of the histogram over a wider range than the current range. This technique is used in image processing too. There we do histogram normalization for enhancing the contrast of poor contrasted images.
Here ./ and .* means operation has to be performed element-wise.
- Read the image.
- Convert color image into grayscale.
- Display histogram.
- Observe maximum and minimum intensities from the histogram.
- Change image type from uint8 to double.
- Apply a formula for histogram normalization.
- Convert back into unit format.
- Display image and modified histogram.
- First, we read the image using imread( ) function.
- After reading the image, we convert it into the grayscale format.
- After converting it into grayscale, we displayed the image and its histogram.
- Maximum and minimum intensity is noted from the histogram.
- The image data type is changed from uint8 to double, to facilitate the calculation steps.
- Apply the formula of normalization.
- The image data type is changed back to uint8.