Name

CreateHistogram — calculates the gray level histogram of an image

Calling Sequence

Histogram = CreateHistogram(Image);

[Histogram, ListOfBins] = CreateHistogram(Image);

Histogram = CreateHistogram(Image, NumberOfBins);

[Histogram, ListOfBins] = CreateHistogram(Image, NumberOfBins);

Parameters

Image

2D matrix of type uint8, uint16, uint32, double or boolean

NumberOfBins

number of gray level intervals for an image of type double. This parameter is optional and it is ignored if Image is of any type other than double.

Histogram

row vector containing the number of pixels for each gray value

ListOfBins

row vector containing the bins. This parameter is optional.

Description

This function calculates the gray level histogram for an image. If the image is of type double, the number of gray level intervals can be specified.

Examples

RGB = ReadImage('contrib\IPD-5.0\demos\teaset.png');

Image = RGB2Gray(RGB);

figure(); ShowImage(Image, 'Gray Level Image');

Histogram = CreateHistogram(Image, 10);

figure(); plot(Histogram);

See also

CreateCumulatedHistogram