Enhance contrast of images using histogram equalization
Analysis & Enhancement
visionanalysis
The Histogram Equalization block enhances the contrast of images by transforming the values in an intensity image so that the histogram of the output image approximately matches a specified histogram.
Port | Input/Output | Supported Data Types | Complex Values Supported |
---|---|---|---|
I | Matrix of intensity values |
| No |
Hist | Vector of integer values that represents the desired intensity values in each bin |
| No |
Output | Matrix of intensity values | Same as I port | No |
If the data type of input to the I port is floating point, the input to Hist port must be the same data type. The output signal has the same data type as the input signal.
Use the Target histogram parameter to designate the histogram you want the output image to have.
If you select Uniform
, the block transforms the input image so that
the histogram of the output image is approximately flat. Use the Number of
bins parameter to enter the number of equally spaced bins you want the
uniform histogram to have.
If you select User-defined
, the Histogram
source and Histogram parameters appear on the dialog
box. Use the Histogram source parameter to select how to specify
your histogram. If, for the Histogram source parameter, you select
Specify via dialog
, you can use the
Histogram parameter to enter the desired histogram of the
output image. The histogram should be a vector of integer values that represents the
desired intensity values in each bin. The block transforms the input image so that the
histogram of the output image is approximately the specified histogram.
If, for the Histogram source parameter, you select Input
port
, the Hist port appears on the block. Use this port to specify
your desired histogram.
Note
The vector input to the Hist port must be normalized such that the sum of the values in all the bins is equal to the number of pixels in the input image. The block does not error if the histogram is not normalized.
See Adjust the Contrast of Intensity Images andAdjust the Contrast of Color Images in the Computer Vision Toolbox™ User's Guide.
Designate the histogram you want the output image to have. If you select
Uniform
, the block transforms the input image
so that the histogram of the output image is approximately flat. If you
select User-defined
, you can specify the
histogram of your output image.
Enter the number of equally spaced bins you want the uniform histogram to
have. This parameter is visible if, for the Target
histogram parameter, you select
Uniform
.
Select how to specify your histogram. Your choices are
Specify via dialog
and Input
port
. This parameter is visible if, for the
Target histogram parameter, you select
User-defined
.
Enter the desired histogram of the output image. This parameter is visible
if, for the Target histogram parameter, you select
User-defined
.