Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %IMHIST Display histogram of N-D image data.
- % IMHIST(I) displays a histogram for the intensity image I whose number
- % of bins are specified by the image type. If I is a grayscale image,
- % IMHIST uses 256 bins as a default value. If I is a binary image, IMHIST
- % uses only 2 bins. I can be 2-D, 3-D or N-D.
- %
- % IMHIST(I,N) displays a histogram with N bins for the intensity image I
- % above a grayscale colorbar of length N. If I is a binary image, then N
- % can only be 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.
- % X can be 2-D, 3-D or N-D.
- %
- % [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, it returns the histogram counts for each colormap
- % entry; the length of COUNTS is the same as the length of the colormap.
- %
- % Class Support
- % -------------
- % An input intensity image can be uint8, int8, uint16, int16, uint32,
- % int32, single, double, or logical. An input indexed image can be uint8,
- % uint16, single, double, or logical. Both I and X can have any number of
- % dimensions.
- %
- % Note
- % ----
- % For intensity images, the N bins of the histogram are each half-open
- % intervals of width A/(N-1).
- %
- % For uint8, uint16, and uint32 intensity images, the p-th bin is the
- % half-open interval:
- %
- % A*(p-1.5)/(N-1) <= x < A*(p-0.5)/(N-1)
- %
- % For int8, int16, and int32 intensity images, the p-th bin is the
- % half-open interval:
- %
- % A*(p-1.5)/(N-1) - B <= x < A*(p-0.5)/(N-1) - B
- %
- % The intensity value is represented by "x". Intensity images of class
- % single and double are assumed to take values in [0 1]. 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 or int8; A is 65535
- % if the intensity image is uint16 or int16; A is 4294967295 if the
- % intensity image is uint32 or int32. B is 128 if the image is int8; B is
- % 32768 if the intensity image is int16; B is 2147483648 if the intensity
- % image is int32.
- % If the intensity values are complex numbers,the function takes the real
- % part and ignores the imaginary part.
- %
- % Example 1
- % -------
- % % Display the histogram of a grayscale image.
- %
- % I = imread('pout.tif');
- % imhist(I)
- %
- % Example 2
- % -------
- % % Display the histogram of a 3-D intensity image.
- %
- % load mristack
- % imhist(mristack)
- %
- % See also HISTEQ, HISTOGRAM, IMHISTMATCH, IMHISTMATCHN.
- % Copyright 1992-2020 The MathWorks, Inc.
Add Comment
Please, Sign In to add comment