Histogram Equalization

Enhance contrast of images using histogram equalization

Library

Analysis & Enhancement

visionanalysis

Description

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.

PortInput/OutputSupported Data TypesComplex Values Supported

I

Matrix of intensity values

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point

  • 8-, 16-, 32-bit signed integer

  • 8-, 16-, 32-bit unsigned integer

No

Hist

Vector of integer values that represents the desired intensity values in each bin

  • Double-precision floating point

  • Single-precision floating point

  • 8-, 16-, 32-bit signed integer

  • 8-, 16-, 32-bit unsigned integer

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.

Examples

See Adjust the Contrast of Intensity Images andAdjust the Contrast of Color Images in the Computer Vision System Toolbox™ User's Guide.

Dialog Box

The Histogram Equalization dialog box appears as shown in the following figure.

Target histogram

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.

Number of bins

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.

Histogram source

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.

Histogram

Enter the desired histogram of the output image. This parameter is visible if, for the Target histogram parameter, you select User-defined.

See Also

imadjust

Image Processing Toolbox™

histeq

Image Processing Toolbox

Was this topic helpful?