The Algorithm of Watershed Color Image Segmentation Based on Morphological Gradient
Abstract
:1. Introduction
1.1. Image Segmentation
1.2. Watershed Algorithm
1.3. The Solution of the Problem
2. Related Work
2.1. Background
2.2. New Algorithm Description
2.3. Gradient of Morphology
2.4. Multiscale Gradient Reconstruction
2.5. Canny Operator
3. Method
3.1. Label Extraction
3.2. Watershed Segmentation
3.3. Improved Algorithm
Algorithm 1 Improved algorithm |
Input: |
Input image: L |
Convert RGB color space to YCbCr color space, and extract three different components: Ib = rgb2ycbcr(I); |
u11 = Ib(:,:,1); |
u12 = Ib(:,:,2); |
u13 = Ib(:,:,3); |
Canny edge detection operator of the three components: |
uw1 = edge(u11,’canny’); uw2 = edge(u12,’canny’); uw3 = edge(u13,’canny’); uw00 = uw1 | uw2 | uw3; |
Used Y-component as the gray image: |
Ig = u11; |
Filter the gray image on and off: |
Io = imopen(Ig,se); |
Ic = imclose(Io,se); |
Multiscale morphological gradient calculation: |
m1 = imdilate(Ic,b1) − imerode(Ic,b1); |
m2 = imdilate(Ic,b2) − imerode(Ic,b2); |
m3 = imdilate(Ic,b3) − imerode(Ic,b3); |
mg1 = imerode(m1,b0); |
mg2 = imerode(m2,b1); |
mg3 = imerode(m3,b2); mgf = (mg1 + mg2 + mg3)/3; |
carry out bottom filling operation and the final watershed operation: |
o5 = imhmin(oo,5); |
k5 = watershed(o5); |
o15 = imhmin(oo,15); |
k15 = watershed(o15); |
o25 = imhmin(oo,25); |
k25 = watershed(o25); |
end |
3.4. Color Space Selection
3.5. YUV Space
3.6. YCbCr Space
3.7. YIQ Space
3.8. t-Test Application
4. Experiment
4.1. Comparison of Image Segmentationbetween the Algorithm in this Paper and Other Algorithm
4.2. Image Segmentation with Salt and Pepper Noise in This Paper
4.3. t-Test of the Image Segmentation Effect
Algorithm 2t-test of the Image Segmentation optimization |
Input: |
Input Resting State |
Independent Two Sample Test: |
idx = num(:,5); |
x = num(:,1); |
x_M = x(idx == 1); x_F = x(idx == 0); |
t Test for homogeneity of variance: |
[p3,stats3] = vartestn(x,idx,…,’TestType’,’LeveneAbsolute’,’Display’,’off’); |
disp(‘Independent t-test with Eyes open:’); disp(‘Levene’s test: p = ’,num2str(p3); |
if p3 < 0.05 disp(‘Equal variances not assumed’) |
[h4,p4,ci4,stats4] = test2(x_M,x_F,…,’Vartype’,’unequal’); |
else |
disp(‘Equal variances assumed’) |
[h4,p4,ci4,stats4] = test2(x_M,x_F); |
end |
5. Results
5.1. Comparison of Average Segmentation Time of the Algorithm
5.2. Comparison Table of Accuracy and Recall Rate of the Algorithm
5.3. Results of t-Test of the RGB Value of the Edge
6. Discussion
7. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Vincent, L.; Soille, P. Watersheds in digital spaces: An efficient algorithm based on immersion simulations. IEEE Trans. Pattern Anal. Mach. Intell. 1991, 13, 583–598. [Google Scholar] [CrossRef] [Green Version]
- Wu, F.; Duan, J.; Ai, P.; Chen, Z.; Yang, Z.; Zou, X. Rachis detection and three-dimensional localization of cut off point for vision-based banana robot. Comput. Electron. Agric. 2022, 198, 1052–1064. [Google Scholar] [CrossRef]
- Tang, Y.; Zhu, M.; Chen, Z.; Wu, C.; Chen, B.; Li, C.; Li, L. Seismic Performance Evaluation of Recycled aggregate Concrete-filled Steel tubular Columns with field strain detected via a novel mark-free vision method. Structures 2022, 37, 426–441. [Google Scholar] [CrossRef]
- Yu, W.; Dian, C.; Mei, S. Watershed Segmentation Based on Morphological Gradient Reconstruction and Marker Extraction. J. Image Graph. 2008, 13, 2176–2180. [Google Scholar]
- Khan, Z.; Yang, J.; Zheng, Y. Efficient clustering approach for adaptive unsupervised colour image segmentation. Sensors 2019, 13, 1763–1772. [Google Scholar] [CrossRef]
- Kurmi, Y.; Chaurasia, V. Multifeature-based medical image segmentation. Sensors 2018, 12, 1491–1498. [Google Scholar] [CrossRef]
- Fernandez-Moral, E.; Martins, R.; Wolf, D. A new metric for evaluating semantic segmentation: Leveraging global and contour accuracy. In Proceedings of the 2018 IEEE Intelligent Vehicles Symposium (IV), Changshu, China, 26–30 June 2018; pp. 1051–1056. [Google Scholar]
- Shi, J.; Malik, J. Normalized cuts and image segmentation. IEEE Trans. Pattern Anal. Mach. Intell. 2000, 22, 888–905. [Google Scholar]
- Roshanzadeh, S.; Afrakhteh, M. Modified Watershed Transform for Automated Brain Segmentation from Magnetic Resonance Images. In Proceedings of the 2nd International Conference on Control and Computer Vision (ICCCV), Seoul, Korea, 27 October–2 November 2019; pp. 60–65. [Google Scholar]
- Xue, Y.; Zhao, J.; Zhang, M. A Watershed-Segmentation-Based Improved Algorithm for Extracting Cultivated Land Boundaries. Remote Sens. 2021, 13, 939. [Google Scholar] [CrossRef]
- Han, J.; Duan, X.; Chang, Z. Target Segmentation Algorithm Based on SLIC and Region Growing. Comput. Eng. Appl. 2020, 57, 213–218. [Google Scholar]
- Madhumitha, S.; Manikandan, M. Quantitative Analysis of Marker-based Watershed Image Segmentation. Curr. Sci. 2018, 114, 1007–1013. [Google Scholar] [CrossRef]
- Zhou, H.; Song, K.; Zhang, X. WAILS: Watershed Algorithm with Image-Level Supervision for Weakly Supervised Semantic Segmentation. IEEE Access 2019, 5, 42745–42756. [Google Scholar] [CrossRef]
- Liu, G.; Dong, W.F.; Jiang, K.M. Recognition of dense fluorescent droplets using an improved watershed segmentation algorithm. Chin. Optics 2019, 12, 783–790. [Google Scholar]
- Tareef, A.; Song, Y.; Huang, H. Multi-Pass Fast Watershed for Accurate Segmentation of Overlapping Cervical Cells. IEEE Trans. Med. Imaging 2018, 9, 2044–2059. [Google Scholar] [CrossRef] [PubMed]
- Wu, W.; Lin, J.; Wang, S.; Li, Y.; Liu, M.; Liu, G.; Cai, J.; Chen, G.; Chen, R. A Novel Multiphoton Microscopy images segmentation method based on superpixel and watershed. J. Biophotonics 2017, 10, 532–541. [Google Scholar] [CrossRef]
- Zhang, J.X.; Zhang, K.P.; Wu, J.K.; Hu, X.D. Color segmentation and extraction of yarn-dyed fabric based on a hyperspectral imaging system. Text. Res. J. 2021, 91, 729–742. [Google Scholar]
- Liu, T.G.; Miao, Q.G.; Tian, K.; Song, J.; Yang, Y.; Qi, Y. SCTMS: Superpixel based color topographic map segmentation method. J. Vis. Commun. Image Represent. 2016, 35, 78–90. [Google Scholar] [CrossRef]
- Wang, J.Q.; Yao, P.P.; Liu, W.L.; Wang, X.L. A Hybrid Method for the Segmentation of a Ferrograph Image Using Marker-Controlled Watershed and Grey Clustering. Tribol. Trans. 2016, 59, 513–521. [Google Scholar] [CrossRef]
- Li, D.R.; Li Deren Zhang, G.F.; Wu, Z.C.; Yi, L.N. An Edge Embedded Marker-Based Watershed Algorithm for High Spatial Resolution RemoteSensing Image Segmentation. IEEE Trans. Image Process. 2010, 19, 2781–2787. [Google Scholar]
- Lu, G.M. A Multiscal Algorithm for Computing Morphological Gradient Images. J. Image Graph. 2001, 6, 214–218. [Google Scholar]
- Guo, Y.H.; Sengur, A.; Akbulut, Y.; Shipley, A. An effective color image segmentation approach using neutrosophic adaptive mean shift clustering. Measurement 2018, 119, 28–40. [Google Scholar] [CrossRef] [Green Version]
- Cao, M.Y.; Wang, S.; Wei, L.; Rai, L.; Li, D.; Yu, H.; Shao, D. Segmentation of immunohistochemical image of lung neuroendocrine tumor based on double layer watershed. Multimed. Tools Appl. 2019, 78, 9193–9215. [Google Scholar] [CrossRef]
- Canny, J. A Computational Approach to Edge Detection. IEEE Trans. Pattern Anal. Mach. Intell. 1986, 8, 679–698. [Google Scholar] [CrossRef] [PubMed]
- Alferez, S.; Merino, A.; Acevedo, A.; Puigví, L.; Rodellar, J. Color clustering segmentation framework for image analysis of malignant lymphoid cells in peripheral blood. Med. Biol. Eng. Comput. 2019, 57, 1265–1283. [Google Scholar] [CrossRef] [PubMed]
- Wisaeng, K.; Sa-ngiamvibool, W. Automatic detection and recognition of optic disk with maker-controlled watershed segmentation and mathematical morphology in color retinal images. Soft Comput. 2018, 22, 6329–6339. [Google Scholar] [CrossRef]
- Kowal, M.; Zejmo, M.; Skobel, M.; Korbicz, J.; Monczak, R. Cell Nuclei Segmentation in Cytological Images Using Convolutional Neural Network and Seeded Watershed Algorithm. J. Digit. Imaging 2020, 33, 231–242. [Google Scholar] [CrossRef] [Green Version]
- Zhang, H.T.; Li, Y.N. Watershed algorithm with threshold mark for color image segmentation. J. Image Graph. 2015, 20, 1602–1611. [Google Scholar]
- Heshmati, A.; Gholami, M.; Rashno, A. Scheme for unsupervised colour-texture image segmentation using neutrosophic set and non-subsampled contourlet transform. IET Image Process. 2016, 10, 464–473. [Google Scholar] [CrossRef] [Green Version]
- Yuan, Y.; Zhu, Z.L.; Yu, H.; Zhang, W. Watershed-Based Superpixels with Global and Local Boundary Marching. IEEE Trans. Image Process. 2020, 29, 7375–7388. [Google Scholar] [CrossRef]
- Chakkaravarthy, A.P.; Chandrasekar, A. Anatomical region segmentation method from dermoscopic images of pigmented skin lesions. Int. J. Imaging Syst. Technol. 2020, 30, 636–652. [Google Scholar] [CrossRef]
- Peng, B.; Zhang, L.; Zhang, D. Automatic Image Segmentation by Dynamic Region Merging. IEEE Trans. Image Process. 2011, 20, 3592–3605. [Google Scholar] [CrossRef] [Green Version]
- Otsu, N. A threshold selection method from gray-level histogram. IEEE Trans Syst. Man Cybernet 1979, 9, 62–66. [Google Scholar] [CrossRef] [Green Version]
- El-Kenawy, E.M.; Ibrahim, A.; Mirjalili, S.; Eid, M.M.; Hussein, S.E. Novel feature selection and voting classifier algorithms for COVID-19 classification in CT images. IEEE Access 2020, 8, 179317–179335. [Google Scholar] [CrossRef] [PubMed]
- Zhang, Z.Y.; Meng, L.H.; Lei, T. Adaptive gradient reconstruction for watershed based image segmentation. J. Image Graph. 2014, 19, 1430–1437. [Google Scholar]
- Aptoula, E.; Lefevre, S. Morphological Description of Color Images for Content-Based Image Retrieval. IEEE Trans. Image Process. 2009, 18, 2505–2517. [Google Scholar] [CrossRef] [Green Version]
- Li, J.B.; Luo, W.; Wang, Z.L.; Fan, S.X. Early detection of decay on apples using hyperspectral reflectance imaging combining both principal component analysis and improved watershed segmentation method. Postharvest Biol. Technol. 2019, 149, 235–246. [Google Scholar] [CrossRef]
- Peng, P.; Wang, J.G. Analysis of oxide wear debris using ferrography image segmentation. Ind. Lubr. Lubr. Tribol. 2019, 71, 901–906. [Google Scholar] [CrossRef]
- Wang, D.; He, D.; Song, H.; Liu, C.; Xiong, H. Combining SUN-based visual attention model and saliency contour detection algorithm for apple image segmentation. Multimed. Tools Appl. 2019, 78, 17391–17410. [Google Scholar] [CrossRef]
- Karimpouli, S.; Tahmasebi, P. Segmentation of digital rock images using deep convolutional autoencoder networks. Comput. Geosci. 2019, 126, 142–150. [Google Scholar] [CrossRef]
- Njeh, I.; Sallemi, L.; Ayed, I.B.; Chtourouae, K.; Lehericybc, S.; Galanaudbc, D.; Hamidaa, A.B. 3D multimodal MRI brain gliomatumor and edema segmentation: A graph cut distribution matching approach. Comput. Med. Imaging Graph. 2015, 40, 108–119. [Google Scholar] [CrossRef]
- Hikal, N.A.; Eid, M.M. A new approach for palmprint image encryption based on hybrid chaotic maps. J. King Saud Univ. Comput. Inf. Sci. 2020, 32, 870–882. [Google Scholar] [CrossRef]
- Makrogiannis, S.; Economou, G.; Fotopoulos, S. Adaptive gradient reconstruction for watershed based image segmentation. IEEE Trans. Syst. Man Cybern. Part B Cybern. 2005, 35, 44–53. [Google Scholar] [CrossRef] [PubMed]
Image | Zone Growth Method | Automatic Threshold Method | Algorithm in This Paper |
---|---|---|---|
Lena | 0.73 | 3.9 | 2.56 |
Pear | 2.88 | 2.4 | 2.2 |
Football | 1.94 | 2.3 | 1.90 |
Colored Chips | 1.69 | 2.5 | 2.19 |
Scenery | 1.87 | 2.7 | 2.34 |
Sailing | 1.76 | 2.58 | 2.16 |
Image | Zone Growth Method | Automatic Threshold Method | Algorithm in This Paper |
---|---|---|---|
Lena | Precision | 0.856 | 0.937 |
0.73 | |||
Recall | 0.9 | 0.928 | |
0.836 | |||
Pear | Precision | 0.778 | 0.912 |
0.796 | |||
Recall | 0.897 | 0.932 | |
0.881 | |||
Football | Precision | 0.833 | 0.935 |
0.746 | |||
Recall | 0.827 | 0.918 | |
0.90 | |||
Colored Chips | Precision | 0.766 | 0.982 |
0.735 | |||
Recall | 0.901 | 0.986 | |
0.891 | |||
Scenery | Precision | 0.853 | 0.975 |
0.787 | |||
Recall | 0.867 | 0.898 | |
0.902 | |||
Sailing | Precision | 0.823 | 0.956 |
0.727 | |||
Recall | 0.767 | 0.828 | |
0.862 |
Image | Literature 11 | Literature 15 | Algorithm in This Paper |
---|---|---|---|
Peppers | 0.736 | 1.952 | 0.938 |
House | 0.782 | 1.473 | 0.731 |
Airplane | 0.941 | 2.323 | 0.947 |
Lena | 0.693 | 1.546 | 0.709 |
Independent t-Test with Eyes | Open: |
---|---|
Levene’s test: p = 0.07 | |
Equal variances assumed | |
t = −1.08 | |
df = 91.00 | |
p = 0.28 |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Wu, Y.; Li, Q. The Algorithm of Watershed Color Image Segmentation Based on Morphological Gradient. Sensors 2022, 22, 8202. https://doi.org/10.3390/s22218202
Wu Y, Li Q. The Algorithm of Watershed Color Image Segmentation Based on Morphological Gradient. Sensors. 2022; 22(21):8202. https://doi.org/10.3390/s22218202
Chicago/Turabian StyleWu, Yanyan, and Qian Li. 2022. "The Algorithm of Watershed Color Image Segmentation Based on Morphological Gradient" Sensors 22, no. 21: 8202. https://doi.org/10.3390/s22218202
APA StyleWu, Y., & Li, Q. (2022). The Algorithm of Watershed Color Image Segmentation Based on Morphological Gradient. Sensors, 22(21), 8202. https://doi.org/10.3390/s22218202