0% found this document useful (0 votes)
45 views2 pages

Imhist

imhist displays a histogram of image data. It can display histograms for grayscale, binary, and indexed images using a default or specified number of bins. It returns the histogram counts and bin locations, allowing the histogram to be plotted externally. imhist is useful for visualizing the intensity distribution of images.

Uploaded by

akashkumar17
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views2 pages

Imhist

imhist displays a histogram of image data. It can display histograms for grayscale, binary, and indexed images using a default or specified number of bins. It returns the histogram counts and bin locations, allowing the histogram to be plotted externally. imhist is useful for visualizing the intensity distribution of images.

Uploaded by

akashkumar17
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

imhist - Display histogram of image data

Syntax
imhist(I)
imhist(I, n)
imhist(X, map)
[counts,x] = imhist(...)

Description

imhist(I) displays a histogram for the image I above a grayscale colorbar.


The number of bins in the histogram is specified by the image type. If I is a
grayscale image, imhist uses a default value of 256 bins. If I is a binary
image, imhist uses two bins.

imhist(I, n) displays a histogram where n specifies the number of bins


used in the histogram. n also specifies the length of the colorbar. If I is a
binary image, n can only have the value 2.

imhist(X, map) displays a histogram for the indexed image X. This


histogram shows the distribution of pixel values above a colorbar of the
colormap map. The colormap must be at least as long as the largest index in
X. The histogram has one bin for each entry in the colormap.
[counts,x] = imhist(...) returns the histogram counts in counts and
the bin locations in x so that stem(x,counts) shows the histogram. For
indexed images, imhist returns the histogram counts for each colormap
entry; the length of counts is the same as the length of the colormap.

Note   The maximum value on the y-axis may be automatically reduced, so outlier spikes do
not dominate. To show the full range of y-axis values, call imhist with the following syntax:
[counts,x] = imhist(...)
Then call stem:
stem(x,counts)

Remarks

For intensity images, the n bins of the histogram are each half-open
intervals of width A/(n−1). In particular, for intensity images that are not
int16, the pth bin is the half-open interval
where x is the intensity value. For int16 intensity images, the pth bin is the
half-open interval

where x is the intensity value. The scale factor A depends on the image
class. A is 1 if the intensity image is double or single, A is 255 if the
intensity image is uint8, and A is 65535 if the intensity image is uint16 or
int16.

Class Support

An input intensity image can be of class uint8, uint16, int16, single,


double, or logical. An input indexed image can be of class uint8, uint16,
single, double, or logical.

Examples
I = imread('pout.tif');
imhist(I)

You might also like