Computes the intensity histogram of an image.
IMHIST(image, nbins)
image |
- |
An array, the input grayscale or RGB image. |
nbins |
- |
Optional. An integer, the number of histogram bins. Defaults to 256. |
A series representing the bin counts.
W1: readimage(gethome + "\data\kasha.jpg"); scalesoff; label("Original")
W2: imhist(W1, 64); label("64-Bin Histogram")

W1 loads a full color JPEG image.
W2 computes and displays a 64-bin histogram representing the combined RGB channel intensity distribution.
W1: readimage(gethome + "\data\siblings.tif", "Gray8"); scalesoff; label("Original")
W2: histeq(W1); setaspect(-1); scalesoff; label("Equalized")
W3: imhist(W1); label("Original Histogram")
W4: imhist(W2); label("Equalized Histogram")

W1 loads an 8-bit grayscale image with pixel intensity values ranging from 0 to 255.
W2 performs histogram equalization to improve image contrast.
W3 displays the histogram of the original image.
W4 displays the histogram of the equalized image, illustrating the transformation to a more uniform intensity distribution.
IMHIST computes the frequency distribution of pixel intensities for a grayscale image.
If the input is an RGB color image, histograms are calculated across the R, G, and B channels independently and summed into a single series.
See HISTEQ to modify an image's contrast using its histogram.