| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Image Processing Toolbox |
| Contents | Index |
| Learn more about Image Processing Toolbox |
imhist(I)
imhist(I, n)
imhist(X, map)
[counts,x] = imhist(...)
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
For intensity images, the n bins of the histogram
are each half-open intervals of width
|
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.
I = imread('pout.tif');
imhist(I)

hist in the MATLAB Function Reference
![]() | imhandles | imhmax | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |