Skip to main content
Advertisement
Browse Subject Areas
?

Click through the PLOS taxonomy to find articles in your field.

For more information about PLOS Subject Areas, click here.

  • Loading metrics

Image segmentation based on gray level and local relative entropy two dimensional histogram

  • Wei Yang,

    Roles Conceptualization, Formal analysis

    Affiliation State GRID Quzhou Power Supply Company, No.6, Xinhe Road, Quzhou, Zhejiang 324000, China

  • Lulu Cai,

    Roles Validation, Writing – original draft

    Affiliation College of Electrical and Information Engineering, Quzhou University, Quzhou, Zhejiang 324000, China

  • Fei Wu

    Roles Data curation, Writing – review & editing

    wufei_qzu@126.com

    Affiliation College of Electrical and Information Engineering, Quzhou University, Quzhou, Zhejiang 324000, China

Abstract

Though traditional thresholding methods are simple and efficient, they may result in poor segmentation results because only image’s brightness information is taken into account in the procedure of threshold selection. Considering the contextual information between pixels can improve segmentation accuracy. To to this, a new thresholding method is proposed in this paper. The proposed method constructs a new two dimensional histogram using brightness of a pixel and local relative entropy of it’s neighbor pixels. The local relative entropy (LRE) measures the brightness difference between a pixel and it’s neighbor pixels. The two dimensional histogram, consisting of gray level and LRE, can reflect the contextual information between pixels to a certain extent. The optimal thresholding vector is obtained via minimizing cross entropy criteria. Experimental results show that the proposed method can achieve more accurate segmentation results than other thresholding methods.

Introduction

Image segmentation is a fundamental task in many computer vision based applications, such as medical image analysis [1], crack detection [2, 3], video analysis [4], plant disease recognition [5], etc. The main purpose of image segmentation is to categorize an image’s pixels to different classes according to color, texture and brightness, etc. Image segmentation is an active research topic and many segmentation methods had been proposed up to now. The clustering based methods [68], regression based methods [9, 10], and deep learning based methods [1113] are the new and sophisticated methods.

Although the above methods can obtain well segmentation performance, however, the computation complexity and computation burden are relatively high. In practice, simple and effective segmentation methods are desirable. Among different image segmentation methods, thresholding segmentation methods are simple, effective and more easy to be implemented. They become popular and have received much attention of researchers. Thresholding methods assume that there is a deep valley between two peaks in the gray level histogram of the image. The ideal thresholds locate at valleys and can be obtained by optimizing a certain criteria function. The Otsu thresholding method selects the ideal threshold by maximizing the between-class variance between background and objects [14], and Kapur’s thresholding method maximizing the total Shannon entropy of background and objects [15], the Kittler’s thresholding method minimizing the classification error [16]. These classical thresholding methods have some improved variants [17]. However, these classical thresholding segmentation methods and their variants take only the brightness information into account and neglect the contextual information between pixels, which may result in poor segmentation performance or even false segmentation. To solve this problem, Abutaleb proposed the concept of two-dimension histogram [18]. The two-dimension histogram can reflect the contextual information between pixels to a certain extent. By virtue of two-dimension histogram, many classical thresholding methods had been extended to two dimensional case, such as two-dimension Otsu thresholding method [19], two-dimension Tsallis entropy thresholding method [20]. Compared with one-dimension histogram based thresholding methods, two-dimension histogram based thresholding methods can get better segmentation result, especially when the image was corrupted by noise. Unfortunately, it was pointed by Xiao that the two-dimension histogram ignores the edge information of image [21]. In image, edge information is a class of important information which can more effectively reflect contextual information between pixels. Observing this, Xiao proposed a new method to construct two dimension histogram by using the resemblance between a pixel and it’s neighbors as the contextual information and the resulted two dimension histogram is called gray level spatial correlation (GLSC) histogram [21]. After that, Xiao et al. constructed another two-dimension histogram, called GLGM histogram using gray level of original image and its gradient magnitude. In [22], a 2-D direction histogram was constructed by using the gray level of original image and the orientation of gradient. Zheng et al. constructed a two-dimension histogram using gray level of original image and its local variance [23].

Motivate by the idea of the mentioned works, a new two-dimension histogram construction method is proposed in this paper. The proposed method constructs a new two dimension histogram using gray level of a pixel and it’s local relative entropy of it’s neighbors. Then, the ideal thresholding vector is selected by minimizing a relative entropy based criterion function.

Entropy and relative entropy

Originally, entropy is a thermodynamic concept, which is used to measure the disorder presented in a system. Entropy became a measure of information amount due to Shannon’s work in [24]. Now, entropy is used to measure the uncertainty of a random variable. Suppose P = {p1, p2, ⋯, pn} and Q = {q1, q2, ⋯, qn} are two different probability distributions. The Shannon entropy of probability distribution P is given as (1) The relative entropy, also called Kullback—Leibler divergence, between P and Q is defined as (2) The relative entropy measures the difference between two distributions P and Q.

Gray level-local relative entropy (GLLRE) two dimensional histogram

Let I(x, y)(x = 1, 2, ⋯, M; y = 1, 2, ⋯, N) be the brightness of a pixel located at (x, y) in the image I. I(x, y) ∈ {0, 1, ⋯, L − 1}. The local relative entropy (LRE) of a pixel (x, y) in a n × n neighborhood is calculated as (3) where is the mean gray level value of the pixels in the neighborhood, which is given as (4) Then LRE of each pixel is normalized to 0 between L − 1 as (5) where Jmin and Jmax are the minimum and maximum of J(x, y). respectively. From Eq (3), it can be seen that LRE measures the difference of brightness of a pixel between the mean brightness of its neighbors. If the brightness of a pixel is similar to it’s neighbors, the LRE is small. On the contrary, the LRE is large. Usually, if a pixel and it’s neighbor pixels belong to the same class, i.e., background or object, then the LRE is small. If a pixel is noise or is edge pixel, then the LRE is large.

To construct two dimensional histogram, one first calculates the number of pixel pairs such that I(x, y) = i and J(x, y) = j, which is denoted as nij. GLLRE histogram is the occurrence frequency, which is calculated as (6) The GLLRE histogram is a two dimensional matrix with size L × L, which is represented as P = {pij; i, j = 0, 1, ⋯, L − 1}. The GLLRE histogram is shown in Fig 1.

GLLRRE based thresholding segmentation method

In Fig 1, threshold vector (s, t) splits the GLLRE into four parts, where s is the threshold of original image and t the local relative entropy image. As mentioned before, the pixels inside the objects and background have small relative entropy, while the pixels located at edge or noises have large relative entropy. Obviously, parts 1 and 4 represent the objects or background, and parts 2 and 3 be the edges or noises. Let C0 and C1 denotes object and background, their probability distribution are (7) and (8) where (9) and (10) To select an ideal threshold vector, an optimization criteria should be determined. In this paper, the minimum relative entropy criteria in [25] is adopted. First, the mean vector of the two classes are calculated as (11) and (12) respectively. The two dimensional relative entropy between original image I and its segmented version at (s, t) is calculated as [25], (13) The ideal threshold vector (s*, t*) is obtained by minimizing D(P, Q|, s, t), i.e., (14)

Experimental results and discussion

In order to illustrate its performance of our proposed method, it is used to segment several images and compared to Otsu thresholding method [14], Otsu method based on GLLRE histogram (Otsu-GLLRE), Kapur method [15] and Kapur method based on GLLRE histogram (Kapur-GLLRE). These methods are implemented on an Intel-i7 3.6GHZ CPU and 8GB memory using Matlab. The images used in the segmentation experiments are Ant (331×240), Cameraman (256×256), Eight (242×308), Ship (215×302), Skrew(218×219), Stone (244×244). All the testing images and their corresponding ground-truth images are shown in Fig 2.

To objectively evaluate the performance of the referenced methods, the misclassification error (ME) is adopted as the evaluation criteria. For bi-level thresholding problem, ME [23] is defined as (15) where |.| represents the element number of a set, Bo is the set containing background pixels of ground-truth image and Fo containing foreground pixels, BT is the set containing background pixels in the thresholded image and FT containing the foreground pixels. ME range from 0 to 1. If ME equals to 0, it implies a perfect segmentation, while equals to 1 for a completely wrong segmentation. The smaller the ME value is, the better our experimental result is.

The segmentation results are shown in Fig 3. For the Ant image, our method achieves the best segmentation result, and Kapur method can not separate the object from background, and other three methods exhibit some over-segmentation phnomenon. For Cameraman image, whatever Kapur and Kapur-GLLRE method give false segmentation result, while our proposed method produces more accurate segmentation result compared to Otsu and Otsu-GLLRE methods. For Eight image, five methods obtain the similar segmentation result. For Ship image, there are much pixels in the background are classified as object and results in mistake segmentation for Otsu, Otsu-GLLRE, Kapur and Kapur-GLLRE method. Our proposed method can extract the ship from background. For Skrew image, apart from our proposed method, the other four methods can not fully extract the second skrew and under-segmentation phenomenon exists. For Stone image, one can see that our method obtain the best segmentation result compared with other referenced methods.

thumbnail
Fig 3. Thresholding results of test image using different methods.

From left to right, the results are obtained by Kapur, Kapur-GLLRE, Otsu and Otsu-GLLRE and the proposed method.

https://doi.org/10.1371/journal.pone.0229651.g003

The thresholds or threshold vectors and ME obtained by the referenced methods are listed in Table 1. It can be seen that ME obtained by our proposed method is the smallest, which indicates that our method obtains the best segmentation results.

thumbnail
Table 1. The threshold or threshold vector, ME of referenced methods.

https://doi.org/10.1371/journal.pone.0229651.t001

Conclusion

A new method is proposed for image segmentation in this paper. The proposed method is based on GLLRE histogram. GLLRE histogram is constructed by utilizing the brightness and local relative entropy of a pixel and it’s neighbors. The local relative entropy can efficiently measures the brightness difference between a pixel and it’s neighbors. The proposed method integrates the contextual information between pixels into the thresholding process and obtains more accurate segmentation results than other thresholding methods.

References

  1. 1. Mabrouk E, Ayman A, Raslan Y, Hedar AR. Immune system programming for medical image segmentation. c. 2019;31:111–125.
  2. 2. Mohan A, Poobal S. Crack detection using image processing: A critical review and analysis. Alexandria Engineering Journal. 2018;57(2):787–798.
  3. 3. Chen H, Zhao H, Han D, Liu K. Accurate and robust crack detection using steerable evidence filtering in electroluminescence images of solar cells. Opt Lasers Eng. 2019;118:22–33.
  4. 4. Zhang L, Lu Y, Lu L, Zhou T. Refined video segmentation through global appearance regression. Neurocomputing. 2019;334:59–67.
  5. 5. Ma J, Du K, Zheng F, Zhang L, Sun Z. A segmentation method for processing greenhouse vegetable foliar disease symptom images. Information Processing in Agriculture. 2019;6(2):216–223.
  6. 6. Parida P, Bhoi N. Fuzzy clustering based transition region extraction for image segmentation. Eng Sci Technol. 2018;21(4):547–563.
  7. 7. Qureshi MN, Ahamad MV. An Improved Method for Image Segmentation Using K-Means Clustering with Neutrosophic Logic. Procedia Comput Sci. 2018;132:534–540.
  8. 8. Chen J, Zheng H, Lin X, Wu Y, Su M. A novel image segmentation method based on fast density clustering algorithm. Eng Appl Artif Intell. 2018;73:92–110.
  9. 9. Schlittgen R, Ringle CM, Sarstedt M, Becker JM. Segmentation of PLS path models by iterative reweighted regressions. Journal of Business Research. 2016;69(10):4583–4592.
  10. 10. Wang W, Wu C. Image segmentation by correlation adaptive weighted regression. Neurocomputing. 2017;267:426–435.
  11. 11. Long J, Shelhamer E, Darrell T. Fully convolutional networks for semantic segmentation. IEEE Trans Pattern Anal Mach Intell. 2017;39(4):640–651. pmid:27244717
  12. 12. Ronneberger O, Fischer P, Brox T. U-Net: Convolutional Networks for Biomedical Image Segmentation. In: International Conference on Medical Image Computing & Computer-assisted Intervention; 2015.
  13. 13. Peng S, Zheng C, Xu F, Xiao H, Nam H, Wu Y. Blood Vessels Segmentation by Using CDNet. In: 2018 IEEE 3rd International Conference on Image, Vision and Computing (ICIVC); 2018. p. 305–310.
  14. 14. Otsu N. A threshold selection method from gray-level histogram. IEEE Trans Syst, Man, Cybern. 1979;9:62–66.
  15. 15. Kapur JN, Sahoo PK, Wong AKC. A new method for gray-level picture thresholding using the entropy of the histogram. Computer Vision, Graphics, and Image Processing. 1985;29:273–285.
  16. 16. Kittler J, Illingworth J. Minimum error thresholding. Pattern Recognit. 1986;19:41–47.
  17. 17. Yuan XC, Wu LS, Peng Q. An improved Otsu method using the weighted object variance for defect detection. Appl Surf Sci. 2015;349:472–484.
  18. 18. Abutaleb A. Automatic thresholding of gray-level pictures using two-dimensional entropy. Computer Vision, Graphics, and Image Processing. 1989;47:22–32.
  19. 19. Liu JZ, Li WQ. The automatic threshold of gray level pictures via two 2 dimensional otsu method (in Chinese). Automatica Sinica. 1993;19(1):101–105.
  20. 20. Sahoo PK, Arora G. Image thresholding using two-dimensional Tsallis-Havrda-Charvat entropy. Pattern Recognit Lett. 2006;27:520–528.
  21. 21. Xiao Y, Cao Z, Zhang T. Entropic thresholding based on gray-level spatial correlation histogram. In: 19th International Conference on Pattern Recognition, 2008; 2008. p. 1–4.
  22. 22. Yimit A, Hagihara Y, Miyoshi T, Hagihara Y. 2-D direction histogram based entropic thresholding. Neurocomputing. 2013;120:287–297.
  23. 23. Zheng X, Hong Y, Tang Y. Image Bi-Level Thresholding Based on Gray Level-Local Variance Histogram. Entropy. 2017;19(5):191–.
  24. 24. Shannon CE. Communication theory of secrecy systems. Bell System Technical Journal. 1949;28:656–715.
  25. 25. Li CH, Lee CK. Minimum cross entropy thresholding. Pattern Recognit. 1993;26:617–625.