300 likes | 606 Views
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.
E N D
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)
Another way to define the Gray-level histogram • Contour lines in an image A(D+D) A(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 D1, then (6)
500象素*546象素= • 273000,最左侧直方 图峰值的灰度级为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 Nk 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,
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
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
SUMMARY OF IMPORTANT POINTS • The gray-level histogram is the negative of the derivative of the threshold area function. • The histogram shows how many pixels occur at each gray level. • Inspection of the histogram points out improper digitization. • The area and IOD of a simple object can be computed from the histogram of its image. • 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题 解:黑色象素数=520+920+490+30+40+5910=7910 白色象素数=6050+80+20+80+440+960+420=7970 足球的总象素=7910+7970=15880 足球的面积=41457.6平方毫米 象素的间距=41457.6/15880=2.6毫米
上机实习 • 1、在matlab软件中编制读取图象并输出其直方图的程序。(不使用 imhist 函数)