• 沒有找到結果。

DIGITAL IMAGE PROCESSING

4.2 Image Processing in the Spatial Domain

4.2.2 Image Segmentation

The main goal of the image processing is to extract meaningful features from a digital image. Image segmentation serves this purpose. Image segmentation extracts constituent parts or objects from the background (Gonzalez & Woods 1987), and it is an important step in image analysis where objects or other entities of interest are extracted from an image for subsequent processing, such as description and recognition (Minor &

Sklansky 1981). Image segmentation algorithms are generally based on one of two basic properties of gray-level values: discontinuity and similarity. The former is based on the mutation segmentation of gray-level, which is primarily applied to the inspection of isolated image points and segment edges. The principal approaches of the latter are based upon thresholding to perform the regional growing, regional splitting and merging.

Popular image segmentation approaches are shown in Fig. 4.6.

Image

Fig. 4.6 Image segmentation methods.

Thresholding is one of the most important approaches to image segmentation. To illustrate the basic concept of thresholding, let us suppose a gray level histogram as shown in Fig. 4.7. The histogram corresponds to an image, f(x, y), composed of light objects on a dark background, such that object and background pixels have gray levels grouped into two modes. One can select a threshold T that separates objects from background. A threshold image f(x, y) can be expressed as follows:

( )

(4.2)

Pixels labeled 1 correspond to objects while pixels labeled 0 correspond to the background. As a matter of fact, the method is binary. Good results can be achieved when there are simple objects against a background with clear contrast.

Threshold-based segmentation adopts various thresholds to recognize interesting objects from images. When T depends only on the image f(x, y), the threshold is called a global threshold. If T depends on an image f(x, y) and a coordinate p(x, y), the threshold is termed a local threshold. Additionally, if T depends on the spatial coordinates x and y, it is called a dynamic threshold. But often an image may not be as simple as the one described above. There may be various changes in the background, for instance. Under such circumstances, the threshold values used in certain regions may not be applied to other regions. Consequently, adaptive and optimal thresholds are also proposed (Miao 1999). In conclusion, threshold-based segmentation method is most applicable to segmentation problems with clear and close boundaries between interesting objects and backgrounds.

(a) (b)

Fig. 4.7 Gray-level histograms that can be partitioned by (a) a single threshold, and (b) multiple thresholds.

Region-oriented segmentation partitions an image into several sub-regions Ri. pixels within a sub-region have certain characteristics; for example, the grey values are within the same range. This is defined as follows (Miao 1999):

(1)

U

i=n1Ri= R null set. However, methods like region growing by pixel aggregation and region splitting and merging are based on the region-oriented segmentation which we do not elaborate here. Please refer to related literature if interested (Gonzalez & Woods 1987; Jain 1989).

There are many ways of dealing with boundary detection-based segmentation. The first-order or second-order derivatives are mainly used for boundary detection. For example, edges are detected based on the first-order derivative. Then smaller edges are connected to a boundary by applying the directions of the first-order derivative. Most boundary detection adopts the aforementioned method. As to the first-order and second-order derivatives for image f(x, y), we define them as follows:

( )

,

( )

, f

( )

x,y j (4.3)

where ∇f

( )

x,y represents the maximum rate of increase of f(x, y) per unit distance in the direction of the gradient vector. The purpose of finding the degree of a gradient is to locate the grey value with the maximum change in an image. Usually this occurs at the boundaries of objects.

Edge detection is by far the most common approach for detecting meaningful discontinuities in gray level. An edge appears in the boundary between two regions with relatively distinct gray-level properties. The idea underlying most edge detection techniques is the computation of a local derivative operator. It mainly adopts first and second derivatives to determine object boundaries. The magnitude of the first derivative can be used to detect the presence of edges. The sign of the second derivative can be used to determine the location of edge pixels. A great deal literature is concerned with boundary detection. The Sobel operation and Laplacian of Gaussian are among the more famous (Gonzalez & Woods 1987). In this study we will confine ourselves to discussion only of the Sobel operation.

Sobel edge detection employs a high-pass filter designed to remove smooth parts in images. The remaining parts represent the pixels where gray levels are changing rapidly, that is, at pixels that lie on edges. The Sobel algorithm is based on the same concept as gradients; the gradient of an image f(x, y) at location (x, y) is defined as the following:

For a discrete digital image, the above formula can be rewritten as follows:

( ) ( )

where Gx andGy represent the components of the gradient vector in the x direction and in the y direction. A 3x3 mask as shown in Fig 4.8(a), P5 represents the gray level at location(x, y) and the other Pi represents the gray level of the 8-neighbors of (x, y). The difference between the third and the first rows of the adjacent regions to a 3x3 mask is similar to the derivative in the x direction as shown in Fig 4.8(b) while the difference between the third and first columns shown in Fig 4.8(c) is similar to the derivative in the y direction. Regarding the spatial algorithm, only multiplication and addition of grey values of pixels can be calculated due to the adoption of the mask. The above calculation is efficient. However, the Sobel edge detection is unsuitable for image detection at a tunneling site based on our review of relevant literature (Jiang 2000; Wu 2000). The processing flow relating to Sobel edge detection is shown in Fig 4.9.

P1 P2 P3

Fig. 4.8 Sobel operation diagram:(a) a 3x3 mask (b) the x direction(c) the y direction.

Read Gray-level Image

Read P1 / 8-neighbors Gray-level values

Calculating Gx Calculating Gy

2 2

y

x G

G temp= +

P1can be substitute by temp

Finishing all operations

Finishing Edge Detection Yes

No

Fig. 4.9 The processing flow as it relates to Sobel edge detection.

相關文件