1 3th ACIS Internatonal Conference on Software Engneerng, Artfcal Intellgence, Networkng arallel/dstrbuted Computng An Improved Image Segmentaton Algo...

Author:
Nathaniel Stafford

0 downloads 133 Views 331KB Size

An Improved Image Segmentation Algorithm Based on the Otsu Method Mengxing Huang, Wenjiao Yu, Donghai Zhu College of Information Science & Technology Hainan University Haikou, P. R. China [email protected]

W1 = {0,1,2, ⋅⋅⋅䯸 T } and W2 = {T + 1䯸 T + 2䯸⋅⋅⋅,L-1} , where L is the total

Abstract—By analyzing the basic principle of Otsu method and its application in image segmentation, and according to the distribution characteristics of the target and background, an improved threshold image segmentation algorithm based on the Otsu method is developed. By narrowing the selection range of threshold and searching the minimum variance ratio, the improved algorithm selects the optimal threshold. Through the compared with the Otsu method and other methods, the results show that the new improved algorithm has these advantages such as high segmentation precision and fast computation speed.

such that

number of the gray levels of the image. Let the number of L-1

pixels at

i =0

number of pixels in a given image. The probability of occurrence of gray level i is defined as

pi =

Keywords- Otsu method; image segmentation; optimal threshold; selection range; minimum variance ratio

I.

INTRODUCTION

T

Pw1 = ¦ pi and Pw 2 = ¦ pi = 1-Pw1 . i =0

The means of the classes

W1 and W2 can be computed

as: T

i * pi i = 0 Pw1 L −1 i * pi = ¦ i =T +1 Pw 2

μ w1 = ¦

(1)

μ w1

(2)

So we can get the equivalent formula:

σ 2 (T ) = Pw1Pw 2 ( μ w1 − μ w 2 ) 2 *

The optimal threshold T can maximizing the between-class variance.

T * = Arg max σ 2 (T ) 0

be

(3) obtained

by (4)

The Otsu method is simple and has a stable affection, so it has been widely applied in image segmentation in practice .It play an important role in the automatic selection of threshold. However, we found that the Otsu method is very sensitive about noise and the size of target. It is only effective to the image with single peak variance after the experiments to many kinds of images. When the difference of the two intra-class variances is large, the threshold of the Otsu method tends to be closer to the class with larger intraclass class variance, which means that more pixels of this class will be classified into the another class [5], so the segmentation result needs to be improved.

OTSU METHOD

Otsu proposed a dynamic threshold selection method in 1979. This method suggests maximizing the weighted sum of between-class variances of foreground and background pixels to establish an optimum threshold [4]. We can partition the image into two classes W1 and W2 at gray T 978-0-7695-4761-9/12 $26.00 © 2012 IEEE DOI 10.1109/SNPD.2012.26

L-1 ni 䯸 p i ≥ 0䯸¦ p i = 1 . W1 and W2 are normally N i =0

corresponding to the object of interested and the background, the probabilities of the two classes are

Image segmentation is one of the basic problems of the image processing and machine vision, its key point is: the image is divided into a number of sets that do not mutual overlapping zones; these zones either have meaning to currently mission or help to explain correspondence between them and the actual object or some parts of object. Image segmentation have a wide range of applications in practice, such as: industry automation, product online detection, manufacturing and process control, remote sensing image processing, biomedical image analysis, etc [1][2]. Threshold is a commonly used method that improves the image segmentation effect obviously, meanwhile it is simpler and easier to implement. However, it fails when the difference of the two within-class variances is large and the result of Otsu method may be present twin peaks or more peaks [3]. By studying the principle of the Otsu method and its application in image segmentation, an improved threshold image segmentation algorithm based on the Otsu method is developed. By narrowing the selection range of threshold and searching the minimum variance ratio, the improved algorithm selects the optimal threshold. The results of the simulation by different images were analyzed, studied, compared. The results show that the improved Otsu algorithm has these advantages such as high segmentation precision and fast computation speed. II.

i gray level be ni , and N = ¦ n i be the total

135

III.

THE PROPOSED OTSU METHOD

L -1

In order to overcome the above problems, this paper presents an improved Otsu method, the main steps of improved Otsu method:

i * pi

㺌P

T2 =

i =T0 +1

(7)

w2

Where the Pw 2 is defined in (2). D. Define the scope of threshold It is very importance to choose a reasonable threshold range for the optimization algorithm. First, we can exclude a large part of the gray values and less time is consumed greatly by narrowing the selection range of threshold. Second, by removing the gray value which is too low or too high, which reduced the noise in the image, so that reduced the false selection rate of the optimal threshold. How to determine the threshold for the range of options, in a number of papers have been discussed. Generally speaking, since the initial threshold value T0 is the mean of whole image, and the most dark areas of image are belong to background, a small part of the lighter areas are the target, the final threshold must be greater than the first threshold value T0 . Therefore, we can set the mean

of class W1 as the lower threshold, which would eliminate a large part of low gray area, meanwhile without losing the potential optimal threshold. For the choice of the range of threshold, we consider the following reasons: When using the initial threshold T0 to segment the original image, due to the exclusion of a large part of low gray background pixels which belong to W1 ,

W1 and

then the proportion of target areas will increases in W2 , the

W2 with the image mean grey value T0 such that W1 = {0,1,2,⋅ ⋅ ⋅䯸 T } and W2 = {T + 1䯸 T + 2䯸⋅ ⋅⋅, L - 1} , where L is the total

mean value T2 increased, which is higher than the target

Figure 1. The main steps of improved Otsu method

A. Initial threshold segmentation We can partition the image into two classes

area, so we set T2 as high threshold. Finally, the scope of threshold value is defined, so that we can search for optimal threshold in [T1 , T2 ] .

number of the gray levels of the image. L -1

T0 = 㺌i * p i

E. Calculate inter-class variance and intra-class variance

(5)

The variance of W1 and W2 are defined as follow:

i =0 L-1

Where

pi =

ni 䯸 p i ≥0䯸㺌p i = 1 N i =0

σ

2

The means of W1 can be computed as: T

Where the

w2

(i - w 2 ) 2 * p i = 㺌 Pw2 i =T +1

Where T 㺃㪲T0 , T1 ] .

(6)

The intra-class can be computed as˖

Pw1 is defined in (1).

2 W

= 2 w1 + 2 w2 . The inter-class can be computed as:

2 i = Pw1 Pw 2 ( w1 - w 2 ) 2

C. Calculate high threshold

F.

Calculate the mean value of the class W2 to get the high threshold

w1

(8)

L 1

B. Calculate lower threshold

0 i*p T1 = 㺌 i i =0 Pw1

(i - μ w1 ) 2 * p i =㺌 Pw1 i =0 T

2

T2 ˖

136

Calculate the minimum variance ratio The minimum variance ratio is defined as:

(9)

λ=

σ 2W σ 2i

The inter-class variance

(10)

σ 2i

indicates the different of

class W1 and W2 . There are more differences between class

W1 and W2 , the larger the σ 2 i will be. The intra-class 2 variance W means the discrete degree of the class W and 1

W2 .The more concentrated the gray in the class W1 and W2 , the littler the σ W will be. Both of the inter-class variance and the intra-class variance are considered when we choose the λ , so if we want to get the best segmentation, this method should make sure that λ as littler as it can. 2

(a)

G.

Image segmentation To divide the 256 grey values into two categories by optimal threshold value. Making all of the grey value of pixels less than T to be 0 and making the gray value of pixels equal or greater than T to 255. IV.

THE RESULTS OF THE SIMULATION EXPERIMENT AND ANALYSIS

In order to evaluate the performance of the proposed method, our algorithm has been tested using images Swan (481*321) and image Orange (256*256) in Fig.2, and Fig.3 shows the histogram of the images. We can find that the difference of the two intra-class variances is large from the histogram of the images, so these images are very suitable to test our algorithm . The basic information of the images showed in table I. TABLE I.

(b)

Figure 2. Original images: (a) Swan, (b) Orange

THE BASIC INFORMATION OF THE IMAGES

Swan

Orange

Pixel number

154401

160000

Maximum gray value

255

255

Minimum gray value

12

20

Average gray values

89.6796

189.7138

Lower threshold

175

186

High threshold

194

220

(a)

137

(a)

(b) Figure 3. The histogram of the image: (a) Swan, (b) Orange

A. The effect of image segmentation The Otsu method is used to segment the image in Fig. 4; however, it gives an incorrect threshold value that fails to isolate the contaminant. However, our method and Zhong's method [6] which is also an image segmentation based on the improved Otsu algorithm successfully isolated the contaminant in the image. We can see from Fig. 5 and Fig. 6 that the proposed method produces images that are successfully distinguished from the backgrounds.

(b) Figure 5.

Segmentation results by method[6]: (a) Swan, (b) Orange

(a) (a)

(b)

(b)

Figure 4. Segmentation results by Otsu method: (a) Swan, (b) Orange

Figure 6. Segmentation results by proposed method: (a) Swan, (b) Orange

138

is more close to the real threshold, so it is a more practical and effective image threshold segmentation method

B. Results analysis Compared the proposed method with Otsu method and the method [6] by repeat the test 100 times. The test results showed in table II. TABLE II.

OPTIMAL THRESHOLD AND COMPUTING TIME Swan

Otsu method Method in [6] Proposed method

ACKNOWLEDGMENT This work is supported by the National Natural Science Foundation of China under Grant No. 71161007, the Social Science Fund Project of Ministry of Education under Grant No. 10YJCZH049, the Key Science and Technology Program of Haikou under Grant No. 2010-0067 and the Scientific Research Initiation Fund Project of Hainan University under Grant No. kyqd1042.

Orange

Optimal threshold

139

177

Average time /ms Optimal threshold Average time /ms

12.78636 173 20.35641

12.84267 185 19.29573

Optimal threshold

175

186

Average time /ms

13.25282

13.24611

REFERENCES [1]

He Jun, Ge Hong, Wang Yu-feng,” Survey on the methods of image segmentation research,” Computer engineering &science, vol.31, no.12, 2009. [2] M. Sezgin and B. Sankur. “Survey over image thresholding techniques and quantitative performance evaluation”, Journal of Electronic Imaging, pp.146-156, 2003. [3] P. K. Sahoo, S.Soltani, A.K. Wong, and Y. C. Chan, “A survey of thresholding techniques”, Computer Vision Graphics, and Image Processing, vol.41, pp. 233-260, 1998 [4] N. Otsu, “A threshold selection method from gray-level histogram”, IEEE Transactions on Systems Man Cybernet, SMC-8 pp. 62-66, 1978. [5] Xu Xiang-yang, Song En-min, JIN Liang-hai, “Characteristic Analysis of Threshold Based on Otsu Criterion”, Acta Electronica Sinica, vol.33, no.14, pp. 188-189, 2007. [6] Qu Zhong, “Research On Image Segmentation Based on the Improved Otsu Algorithm “, Computer Science, vol.36, no.5, pp. 276278, 2009. [7] Jiang Qin-yu, Li Ping, Sun Lan,”Application of Otsu method in motion detection system”, Journal o f Computer Applications, vol.31, no.1, pp. 260-262,2011. [8] Hu Chang-hua, Nie Zhi-fei, Zhou Zhi-jie, ”Maximum Classes Square Error Bi-histogram Algorithm”, System Simulation Technology, vol.6, no.4, pp. 259-262,2010. [9] Chen S D, Ram Li A R. “Contrast enhancement using recursive mean-separate histogram equalization for scalable brightness preservation”, IEEE Transactions on Consumer Electronics, vol.49, no.4, pp. 1301-1309, 2003. [10] H. Lee, R. H. Park. “Comments on an optimal threshold scheme for image segmentation”, IEEE Trans. Syst.Man Cybern, SMC-20, pp.741-742, 1990. [11] J. Z. Liu, W. Q. Li, “The Automatic thresholding of gray-level picture via two-dimensional Otsu method”, Acta Automatica Si.19, pp.101105, 1993.

Following conclusions from table II can be gained. The threshold of Otsu method getting optimal threshold is smaller than that the method [6] and the proposed method get. From the histogram of the image Swan and Orange, we can find that the size of background and target is very different. The variance of background is big and the variance of target is small. According to the principle that when the difference of the two variances is large, the threshold of the Otsu method tends to be closer to the class with larger variance, which means that threshold will be small than the real threshold. This means that the thresholds of the method in [6] and the proposed method is more close to the real threshold than the threshold of the Otsu method. Meanwhile, the time of Otsu method and the proposed method consume is less than that the method [6] need. The reason is that the complexity of the proposed method and the method [6] are increased, but the time of the proposed method is reduced by narrowing the range of threshold selection. V.

CONCLUSIONS

By analyzing the basic principle of Otsu method and its application in image segmentation, and according to the distribution characteristics of the target and background, an improved threshold image segmentation algorithm based on the Otsu method is developed. By narrowing the selection range of threshold and searching the minimum variance ratio, the improved algorithm selects the optimal threshold. Through the compared with the Otsu method and other methods, the results show that the new improved algorithm

139

Our partners will collect data and use cookies for ad personalization and measurement. Learn how we and our ad partner Google, collect and use data. Agree & Close