Version (1.59 KB) by ja
multi-dimension greyscale histogram smoothing and equalization
Updated 27 May 2015

View License

Performs a smooth histogram equalization on an image, without the missing 'chunks' in common histogram equalizers. Uses local information to rank pixel values and assign new ones. Up to three inputs:
1) Image to be equalized (required)
2) Test image for (1) to be mapped to (optional)
3) A vector of background pixel values to be omitted from equalization (optional)
Some assumptions are made to make the inputs more convenient. i.e. if you do not have a (2), you should be able to only input (1) and (3), without a placeholder for (2), and the program should be able to detect it.
In the event (2) and (3) are not used, the result is an image with a completely flat histogram, with small deviations to account for odd numbers of pixels.

If (2) is used, the resulting image will have an identical histogram to the image in (2). If (2) is not the same size as (1), it is scaled.

If (3) is used, but not (2), the result is a completely flat histogram with the exception of the values in (3) - they retain their original counts in the histogram.

If both (2) and (3) are used, the result is an image with an identical histogram to (2), with the exception of the values in (3) retaining their original counts.

This should work for any number of dimensions. But this is a greyscale-only function. To use this in color you must treat each frame independently.

Cite As

ja (2024). hiseq(Image,TestImage,Background) (https://www.mathworks.com/matlabcentral/fileexchange/50984-hiseq-image-testimage-background), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Histograms in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

fixed a bug that resulted in NaN values