Enhance contrast using histogram equalization
[___,
also returns the transformationT
] = histeq(___)T
that maps the gray component of the input grayscale image or color map to the gray component of the output grayscale image or color map.
When you supply a desired histogramh
,histeq
chooses the grayscale transformationT
最小化
c0是输入图像的累积直方图I
,和c1is the cumulative sum ofh
for all intensitiesk。This minimization is subject to these constraints:
T
必须是单调的
c1(t(a))不能过度c0(a)直方图计数之间的距离超过一半a
histeq
uses the transformationb=T(a)映射灰度级别X
(or the color map) to their new values.
If you do not specifyh
, thenhisteq
creates a flath
,
h= ones(1,n)*prod(size(A))/n;
and then applies the previous algorithm.