International Journal of Mathematical, Engineering and Management Sciences

ISSN: 2455-7749

Segmentation of Covid-19 Affected X-Ray Image using K-means and DPSO Algorithm

Roopa Kumari
Department of Computer Science, Gurukula Kangri Vishwvidyalya, Haridwar, Uttarakhand, India.

Neena Gupta
Department of Computer Science, Gurukula Kangri Vishwvidyalya, Haridwar, Uttarakhand, India.

Narender Kumar
Department of Computer Science, Doon University, Dehradun, Uttarakhand, India.


Received on May 14, 2021
Accepted on July 31, 2021


Covid-19, a disease that originated in the Chinese city of Wuhan, has spread across almost the entire globe. Pneumonia, which infects the lungs, is one of the symptoms of this disease. In the past X-ray images were used to segment various diseases such as pneumonia, tuberculosis, or lung cancer. Recent studies showed that Covid-19 affects the lungs. As a result, an X-ray imaging could help to detect and diagnose Covid-19 infection. This study presents a novel hybrid algorithm (CHDPSOK) for segmenting a Covid-19 infected X-ray image. To find Covid-19 contamination in the lungs, we use a segmentation-based approach using K-means and Dynamic PSO algorithm. In the present paper, segmentation of infected regions in the X-ray image uses a cumulative histogram to initialize the population of the PSO algorithm. In a dynamic PSO algorithm, the velocity of the particle changes dynamically which is useful to avoid the local minima. K-means is used to change the position of the particle dynamically for better convergence. To validate the segmentation performance of our algorithm, we used the Kaggle dataset in our experiments. The performance of the proposed method is analyzed both qualitatively and quantitatively. The results explicitly demonstrate the outperformance of the proposed algorithm.

Keywords- Covid-19, Chest X-ray, Image segmentation, Particle swarm optimization, K-means


Kumari, R., Gupta, N., & Kumar, N. (2021). Segmentation of Covid-19 Affected X-Ray Image using K-means and DPSO Algorithm. International Journal of Mathematical, Engineering and Management Sciences, 6(5), 1255-1275.

Conflict of Interest

The authors confirm that there is no conflict of interest to declare for this publication.


This research did not receive any specific grant from funding agencies in the public, commercial, or not-for-profit sectors. The authors would like to thank the editor and anonymous reviewers for their comments that help improve the quality of this work.


Ahishali, M., Degerli, A., Yamac, M., Kiranyaz, S., Chowdhury, M.E., Hameed, K., Hamid, T., & Gabbouj, M. (2020). A comparative study on early detection of covid-19 from chest x-ray images. arXiv preprint arXiv:2006.05332.

Ahmadyfard, A., & Modares, H. (2008). Combining PSO and K-means to enhance data clustering. In 2008 International Symposium on Telecommunications (pp. 688-691). IEEE. Tehran, Iran.

Ai, T., Yang, Z., Hou, H., Zhan, C., Chen, C., Lv, W., & Xia, L. (2020). Correlation of chest CT and RT-PCR testing for coronavirus disease 2019 (COVID-19) in China: a report of 1014 cases. Radiology, 296(2), E32-E40.

Apostolopoulos, I.D., & Mpesiana, T.A. (2020). Covid-19: automatic detection from x-ray images utilizing transfer learning with convolutional neural networks. Physical and Engineering Sciences in Medicine, 43(2), 635-640.

Asif, S., & Wenhui, Y. (2020). Automatic detection of COVID-19 using X-ray images with deep convolutional neural networks and machine learning. medRxiv.

Bezdek, J.C. (1981). Objective function clustering. In Pattern Recognition with Fuzzy Objective Function Algorithms. Springer, Boston, pp. 43-94.

COVID-19 data github (2020). Retrieved from:

Das, D., Santosh, K.C., & Pal, U. (2020). Truncated inception net: COVID-19 outbreak screening using chest X-rays. Physical and Engineering Sciences in Medicine, 43(3), 915-925.

Dhanachandra, N., & Chanu, Y.J. (2020). An image segmentation approach based on fuzzy c-means and dynamic particle swarm optimization algorithm. Multimedia Tools and Applications, 79, 18839-18858.

Dhanachandra, N., Manglem, K., & Chanu, Y.J. (2015). Image segmentation using K-means clustering algorithm and subtractive clustering algorithm. Procedia Computer Science, 54, 764-771. DOI: 10.1016/j.procs.2015.06.090.

Dunn, J.C. (1973). A fuzzy relative of the ISODATA process and its use in detecting compact well-separated clusters. Journal of Cybernetics, 3(3), 32-57. DOI: 10.1080/01969727308546046.

Fang, Y., Zhang, H., Xie, J., Lin, M., Ying, L., Pang, P., & Ji, W. (2020). Sensitivity of chest CT for COVID-19: comparison to RT-PCR. Radiology, 296(2), E115-E117.

Giannis, D., Ziogas, I.A., & Gianni, P. (2020). Coagulation disorders in coronavirus infected patients: COVID-19, SARS-CoV-1, MERS-CoV and lessons from the past. Journal of Clinical Virology, 127, 104362.

Haghanifar, A., Majdabadi, M.M., Choi, Y., Deivalakshmi, S., & Ko, S. (2020). Covid-cxnet: Detecting covid-19 in frontal chest x-ray images using deep learning. arXiv preprint arXiv:2006.13807.

Isa, N.A.M., Salamah, S.A., & Ngah, U.K. (2009). Adaptive fuzzy moving K-means clustering algorithm for image segmentation. IEEE Transactions on Consumer Electronics, 55(4), 2145-2153.

Kennedy, J., & Eberhart, R. (1995). Particle swarm optimization. In Proceedings of ICNN'95-International Conference on Neural Networks (Vol. 4, pp. 1942-1948). IEEE. Perth, WA, Australia.

Kumar, N., & Srivastava, T. (2011). A PSO based approach to image reconstruction from projections. International Journal of Tomography & Statistics, 17(S11), 29-38.

Kumari, R., Gupta, N., & Kumar, N. (2020). Cumulative histogram based dynamic particle swarm optimization algorithm for image segmentation. Indian Journal of Computer Science and Engineering, 11(5), 557-567.

Li, H., He, H., & Wen, Y. (2015). Dynamic particle swarm optimization and K-means clustering algorithm for image segmentation. Optik, 126(24), 4817-4822.

MacQueen, J. (1967). Some methods for classification and analysis of multivariate observations. In Proceedings of the Fifth Berkeley Symposium on Mathematical Statistics and Probability (Vol. 1, No. 14, pp. 281-297). University of California, Berkeley.

Mangal, A., Kalia, S., Rajgopal, H., Rangarajan, K., Namboodiri, V., Banerjee, S., & Arora, C. (2020). CovidAID: COVID-19 detection using chest x-ray. arXiv preprint arXiv:2004.09803.

Mashor, M.Y. (2000). Hybrid training algorithm for RBF network. International Journal of the Computer, the Internet and Management, 8(2), 50-65.

Omran, M.G., Engelbrecht, A.P., & Salman, A. (2004). Image classification using particle swarm optimization. In Tan, K.C. (ed) Recent Advances in Simulated Evolution and Learning. World Scientific, Singapore, pp. 347-365.

Pearson, K. (1895). X. Contributions to the mathematical theory of evolution.—II. Skew variation in homogeneous material. Philosophical Transactions of the Royal Society of London A, 186, 343-414.

Prabha, K.A., & Visalakshi, N.K. (2014). Improved particle swarm optimization based k-means clustering. In 2014 International Conference on Intelligent Computing Applications (pp. 59-63). IEEE. Coimbatore, India.

Saini, G., & Kaur, H. (2014). A novel approach towards K-mean clustering algorithm with PSO. International Journal of Computer Science and Information Technologies, 5, 5978-5986.

Siddiqui, F.U., & Isa, N.A.M. (2011). Enhanced moving K-means (EMKM) algorithm for image segmentation. IEEE Transactions on Consumer Electronics, 57(2), 833-841.

Sulaiman, S.N., & Isa, N.A.M. (2010). Adaptive fuzzy-K-means clustering algorithm for image segmentation. IEEE Transactions on Consumer Electronics, 56(4), 2661-2668.

Van der Merwe, D.W., & Engelbrecht, A.P. (2003). Data clustering using particle swarm optimization. In The 2003 Congress on Evolutionary Computation-CEC 2003, (Vol. 1, pp. 215-220). IEEE. Canberra, ACT, Australia.

Xiaoqiong, W., & Zhang, Y.E. (2020). Image segmentation algorithm based on dynamic particle swarm optimization and K-means clustering. International Journal of Computers and Applications, 42(7), 649-654.

Xie, X., Zhong, Z., Zhao, W., Zheng, C., Wang, F., & Liu, J. (2020). Chest CT for typical Coronavirus disease 2019 (COVID-19) pneumonia: relationship to negative RT-PCR testing. Radiology, 296(2), E41-E45.

Privacy Policy| Terms & Conditions