Image histogram describes the statistical characteristics of each gray level of the image, he represents the image of each gray level and the gray level of the corresponding relationship between the frequency, because the gray level is not continuous, natural, gray histogram is a discrete function. The horizontal axis is the gray level G, the ordinate is Ng, if the total pixel is N, the gray level is l,pg=ng/n. Then ng--g constitute a grayscale histogram, pg--g form a normalized grayscale histogram.
Using Matlab, Imhist (I), imhist (i,n) means that the grayscale level is evenly divided into n small intervals, [Counts,x]=imhist (...) Returns the number of pixels in each grayscale interval and the corresponding vector between the gray cells. Use STEM (x,counts) to draw a grayscale histogram.
I=imread (' pout.tif ');
L=rgb2gray (I); the percent is converted to our familiar two-value image, which is the two-value grayscale image.
[M,n]=size (L);
[Counts,x]=imhist (l,32);
counts=counts/m/n;
Stem (x,counts);
Effect: