Chapter 5 The Gray-Level Histogram ( 灰度直方图 ) The gray-level histogram is a function showing, for each gray level, the number of pixels in the image that have that gray level. The abscissa of a gray-level histogram is gray level and the ordinate is frequency of occurrence (number of pixels)
Image Lenna The Histogram of Lenna
Another way to define the Gray-level histogram Contour lines in an image A(D) A(D+ D)
For continuous image, the histogram H(D) is defined as: (1) Where A(D) is the threshold area function of a continuous image. For the case of digital functions, fix D=1, (2)
The Two-Dimensional Histogram The two-dimensional histogram shows how the pixels are distributed among combinations of two gray levels For two images, obtained through colored filters, in red and blue light, the value of the two-dimensional histogram at the coordinate is the number of corresponding pixel pairs having gray level in the red image and gray level in the blue image.
Properties of the Histogram (3) (4) For a discrete image, (5)
If an image contains a single uniformly gray object on a contrasting background, and the boundary of that object has the contour line defined by gray level D 1, then (6)
500 象素 *546 象素 = ,最左侧直方 图峰值的灰度级为 33
从灰度 54 到 255 级 约占图象总面积的 60%
Probability density function(PDF): Normalize the gray-level histogram by dividing by the area of the image, i.e., Cumulative distribution function (CDF):
USES OF THE HISTOGRAM Digitizing Parameters Checking the histogram can bring problems into the open before much time has been wasted
Boundary Threshold Selection Suppose an image contains a dark object on a light background, its histogram is a bimodal one A threshold gray level chosen in the area of the dip will produce a reasonable boundary for the object
显然如果阈值对应于直方图的谷,阈值从 T 增加到 T+ ΔT ,只会导致面积略微变化。因此可以把阈值的选择 误差对面积测量的影响降到最低。 上例中当灰度级从 115 变化到 144 时,象素为 1850 , 占图象总面积的 1% 。因此把阈值选取为 130 ,此时 树叶的面积约占总面积 28.87% 。
Integrated Optical Density (IOD) For a digital image It can be written as where N k is the number of pixels with gray level k
For continuous image and If an object within the image if enclosed by a threshold boundary at gray level T,
The mean interior gray level is the ratio of IOD to area:
RELATIONSHIP BETWEEN HISTOGRAM AND IMAGE One dimension Consider the one-dimensional Gaussian pulse given by
The area is merely the inverse of the image function The histogram is given by
The histogram of the Gaussian pulse
Two Dimensions The image function in polar coordinates is given by A Contour of constant gray level P is a circle of radius Such a contour encloses an area
The histogram is given by
SUMMARY OF IMPORTANT POINTS 1. The gray-level histogram is the negative of the derivative of the threshold area function. 2. The histogram shows how many pixels occur at each gray level. 3. Inspection of the histogram points out improper digitization. 4. The area and IOD of a simple object can be computed from the histogram of its image. 5. The histogram of an image of specified functional form can be derived with the aid of the area function.
习题 P68 第 3 题 解:
习题
从图中观察阈值灰度约可定在 100 物体的 IOD= 物体的面积 =
习题 P68 第 4 题 解:黑色象素数 = =7910 白色象素数 = =7970 足球的总象素 = =15880 足球的面积 = 平方毫米 象素的间距 = /15880=2.6 毫米
上机实习 1 、在 matlab 软件中编制读取图象并输出其直方图的 程序。 ( 不使用 imhist 函数 )