SIVP Toolbox
Last update : April, 2006

imhist - get the histogram of an image

Calling Sequence

[counts, cells] = imhist(im)
[counts, cells] = imhist(im, bins)
[counts, cells] = imhist(im, bins [,width [,color]])

Parameters

Description

imhist return the histogram of an image. If more than 2 arguments are give, the histogram will be shown in a figure.

If step is the step of scalar cells (cells(i+1)=cells(i)+step), the i'th bin is half-open interval (cells(i)-step/2, cells(i)+step/2] for i > 1, and [cells(1)-step/2, cells(1)+step/2] for i=1.

If more than 2 arguments are given, the function will call bar(cells, counts, ...) and send rest arguments to bar function to display the histogram.

Supported image type

BOOLEAN, UINT8, INT8, UINT16, INT16, INT32, DOUBLE.

Examples


    im = imread('lena.png');
    im = rgb2gray(im);
    [count, cells]=imhist(im);
    [count, cells]=imhist(im, 10);
    scf(0); imhist(im, 10, '');
    scf(1); imhist(im, 10, 0.5);
    scf(2); imhist(im, 10, 'green');
    scf(3); imhist(im, 10, 0.8, 'green');

Authors

Shiqi Yu <shiqi.yu[at]gmail.com>

Availability

The latest version of SIVP can be found at

http://sivp.sourceforge.net

See Also

mean2,  corr2,