histeq
Enhance contrast using histogram equalization
Syntax
Description
transforms the colormap associated with the indexed image newcmap = histeq(X,map,hgram)X
so that the histogram of the gray component of the indexed image
(X,newcmap) approximately matches
the target histogram hgram. The histeq
function returns the transformed colormap in newcmap.
length(hgram) must be the same as
size(map,1).
Examples
Input Arguments
Output Arguments
Algorithms
When you supply a target histogram hgram, histeq
chooses the grayscale transformation T to minimize
c0 is the cumulative
histogram of the input image I, and
c1 is the cumulative sum of
hgram for all intensities k. This
minimization is subject to these constraints:
Tmust be monotonicc1(T(a)) cannot overshoot c0(a) by more than half the distance between the histogram counts at a
histeq uses the transformation b
= T(a) to map the gray levels in
X (or the colormap) to their new values.
If you do not specify hgram, then histeq creates a
flat hgram,
hgram = ones(1,n)*prod(size(A))/n;
and then applies the previous algorithm.




