The Enhancing Accuracy in Mycobacterium Tuberculosis Counting on Acid-Fast Bacteria Sputum through Microscope Camera and Image Processing with Thresholding Method

  • Achmad Agus Sholichuddin Department of Medical Electronics Technology, Poltekkes Kemenkes Surabaya, Surabaya, Indonesia
  • M. Prastawa Assalim T.P Department of Electromedical Engineering, Poltekkes Kemenkes Surabaya, Surabaya, Indonesia
Keywords: Tuberculosis, Python, Acid-Fast Bacteria


Tuberculosis (TB) is a chronic infectious illness. Pulmonary TB is still a global threat and concern. Currently, TB is among the top 10 causes of death in the world in 2015 and it is estimated that there are around 10.4 million new cases of TB in the world. 6 countries account for around 60% of new cases in the world: India, Indonesia, China, Nigeria, Pakistan, and South Africa. Globally, the TB death rate was around 22% of total world deaths from 2000 to 2015. This study introduces an innovative tool, the "Microscope Camera for Enhanced Mycobacterium Tuberculosis Counting in Acid-Fast Bacteria Sputum through Image Processing with Thresholding Method," designed to revolutionize the examination of tuberculosis (TB) samples. In response to the global threat of Pulmonary Tuberculosis, the tool employs a state-of-the-art CMOS-HD (Complementary metal-oxide-semiconductor High Definition) camera module and leverages the Python application for efficient image processing. The primary objective is to address the limitations faced by conventional diagnostic methods, particularly the challenges associated with the Rapid Molecular Test Method due to its dependence on expensive equipment, thereby making it less feasible for implementation in resource-constrained public health centers. The study underscores the persistent threat of TB as a global health concern, emphasizing its prevalence, with approximately 10.4 million new cases worldwide. Focusing on Ziehl-Neelsen stain sputum samples, the research seeks to elevate the accuracy of TB diagnosis by proposing a streamlined approach. This involves integrating a digital microscope system with a CMOS-HD camera module and utilizing advanced image processing techniques, specifically the Python Thresholding method. In the methodology, the research outlines a comprehensive data collection and analysis process. Mechanical and block diagrams illustrate the design of the module, while the system flow diagram elucidates the sequence of steps involved in TB sample analysis. The data analysis section employs metrics such as average, percentage error, and success percentage, providing a quantitative assessment of the system's performance. The results reveal an encouraging average system accuracy of 85.30%, demonstrating the potential of the developed tool to enhance the diagnostic process. However, the study transparently acknowledges areas for improvement, particularly in addressing discrepancies between manual and system calculations. The conclusion emphasizes the tool's promising role in assisting healthcare workers in detecting and counting TB bacteria in sputum, underscoring the need for ongoing refinements to achieve a definitive 100% accuracy and eliminate the possibility of misdiagnoses.


Download data is not yet available.


H. Hermansyah, K. Karneli, R. Refai, H. Handayani, and F. Fandianta, “Kualitas Sputum Dalam Pemeriksaan Bta Metode Ziehl Nelssen Dan Test Cepat Molekuler,” J. Med. Lab. Sci., vol. 2, no. 1, pp. 40–52, 2022, doi: 10.36086/medlabscience.v2i1.1216.

D. J. Samuel and R. K. Baskaran, “Design to automate the detection and counting of Tuberculosis(TB) bacilli,” pp. 1–7, 2021, [Online]. Available:

A. Kurniawardhani, R. Kurniawan, I. Muhimmah, and S. Kusumadewi, “Study of Colour Model for Segmenting Mycobacterium Tuberculosis in Sputum Images,” IOP Conf. Ser. Mater. Sci. Eng., vol. 325, no. 1, pp. 0–7, 2018, doi: 10.1088/1757-899X/325/1/012010.

M. M. Puri et al., “Fluorescein Diacetate Vital staining for detecting viability of acid-fast bacilli in sputum of pulmonary tuberculosis patients,” Indian J. Tuberc., vol. 69, no. 4, pp. 626–634, 2022, doi: 10.1016/j.ijtb.2021.09.012.

A. K. M. Yusoff, R. A. A. Raof, N. Mahrom, S. S. M. Noor, F. F. Zakaria, and P. Len, “Enhancement and Segmentation of Ziehl Neelson Sputum Slide Images using Contrast Enhancement and Otsu Threshold Technique,” J. Adv. Res. Appl. Sci. Eng. Technol., vol. 30, no. 1, pp. 282–289, 2023, doi: 10.37934/araset.30.1.282289.

Y. Hong, “The Application of Image Processing Technology in Camera Picture,” Comput. Intell. Neurosci., vol. 2022, 2022, doi: 10.1155/2022/9899610.

A. Rachmad, N. Chamidah, and R. Rulaningtyas, “Mycobacterium tuberculosis images classification based on combining of convolutional neural network and support vector machine,” Commun. Math. Biol. Neurosci., vol. 2020, no. June, pp. 1–13, 2020, doi: 10.28919/cmbn/5035.

E. Kotei and R. Thirunavukarasu, “Computational techniques for the automated detection of mycobacterium tuberculosis from digitized sputum smear microscopic images: A systematic review,” Prog. Biophys. Mol. Biol., vol. 171, no. March, pp. 4–16, 2022, doi: 10.1016/j.pbiomolbio.2022.03.004.

W. N. Waluyo, R. Rizal Isnanto, and Adian Fatchur Rochim, “Comparison of Mycobacterium Tuberculosis Image Detection Accuracy Using CNN and Combination CNN-KNN,” J. RESTI (Rekayasa Sist. dan Teknol. Informasi), vol. 7, no. 1, pp. 80–87, 2023, doi: 10.29207/resti.v7i1.4626.

R. Rulaningtyas, A. B. Suksmono, T. L. R. Mengko, and P. Saptawati, “Identification of mycobacterium tuberculosis in sputum smear slide using automatic scanning microscope,” AIP Conf. Proc., vol. 1656, no. July, 2015, doi: 10.1063/1.4917142.

R. H. Dawwas, “TBC Bacteria Detection in Microscopic Image With Watershed Countur Method,” [CEPAT] J. Comput. Eng. Progress, Appl. Technol., vol. 1, no. 03, p. 28, 2022, doi: 10.25124/cepat.v1i03.5315.

S. Nuriah, U. Ruhimat, R. Aryadi, and R. N. Mutmainah, “Screening of Pulmonary Tuberculosis in Household Contacts With Acid Fast Bacteria (AFB) Positive Pulmonary Tuberculosis Patients in Ciwangi Village, Balubur Limbangan Subdistrict, Garut District,” Mukhtabar J. Med. Lab. Technol., vol. 1, no. 1, pp. 19–25, 2023, doi: 10.52221/mjmlt.v1i1.218.

R. Cruz and U. Paz, “Detection of Mycobacterium Tuberculosis by Microscopic Examination and Gene Expert in a Suspected Patient with Pulmonary Tuberculosis Disease , in Dili City , East Timor,” vol. 7, pp. 11–16, 2024.

F. Satria, P. Widiyanti, and R. Apsari, “Digital detection system design of mycobacterium tuberculosis through extraction of sputum image,” Indones. J. Trop. Infect. Dis., vol. 3, no. 1, pp. 35–38, 2012.

G. K. Chadha, A. Srivastava, A. Singh, R. Gupta, and D. Singla, “An Automated Method for Counting Red Blood Cells using Image Processing,” Procedia Comput. Sci., vol. 167, no. 2019, pp. 769–778, 2020, doi: 10.1016/j.procs.2020.03.408.

A. Goyal, M. Roy, P. Gupta, M. K. Dutta, S. Singh, and V. Garg, “iMedPub Journals Automatic Detection of Mycobacterium tuberculosis in Stained Sputum and Urine Smear Images Abstract,” iMedPub Journals Arch. Clin. Microbiol., vol. 6, no. 3:5, pp. 1–4, 2015, [Online]. Available:

M. Zachariou, O. Arandjelović, W. Sabiiti, B. Mtafya, and D. Sloan, “Tuberculosis Bacteria Detection and Counting in Fluorescence Microscopy Images Using a Multi-Stage Deep Learning Pipeline,” Inf., vol. 13, no. 2, 2022, doi: 10.3390/info13020096.

A. Hamza and T. H. Boumediene, “Comparative between local thresholding and adaptative thresholding concepts in image processing using Matlab,” no. December 2019, pp. 0–5, 2020.

H. Zhang and J. Yao, “Automatic Focusing Method of Microscopes Based on Image Processing,” Math. Probl. Eng., vol. 2021, 2021, doi: 10.1155/2021/8243072.


S. Baliga et al., “Rapid method for detecting and differentiating Mycobacterium tuberculosis complex and non-tuberculous mycobacteria in sputum by fluorescence in situ hybridization with DNA probes,” Int. J. Infect. Dis., vol. 75, no. July, pp. 1–7, 2018, doi: 10.1016/j.ijid.2018.07.011.

T. J. Strovas, “Handbook of Hydrocarbon and Lipid Microbiology,” Handb. Hydrocarb. Lipid Microbiol., no. December 2009, 2010, doi: 10.1007/978-3-540-77587-4.

W. Zhang et al., “An Improved Python-Based Image Processing Algorithm for Flotation Foam Analysis,” Minerals, vol. 12, no. 9, 2022, doi: 10.3390/min12091126.

C. E. Widodo, K. Adi, and R. Gernowo, “Medical image processing using python and open cv,” J. Phys. Conf. Ser., vol. 1524, no. 1, 2020, doi: 10.1088/1742-6596/1524/1/012003.

N. R. Suryani, L. Lillah, and E. Alia, “Kesesuaian Uji Cepat Antigen Mycobacterium tuberculosis dengan Pulasan BTA pada Tersangka Tuberkulosis Paru,” J. Kesehat. Andalas, vol. 7, no. Supplement 4, p. 30, 2018, doi: 10.25077/jka.v7i0.918.

R. Maqsood et al., “Molecular detection and characterization of the Mycobacterium tuberculosis complex subspecies responsible for bovine tuberculosis in Punjab, Pakistan.,” Microbiol. Spectr., no. January, p. e0269223, 2024, doi: 10.1128/spectrum.02692-23.

M. Jadhav, P. P. Janrao, and K. V Kale, “Article: Acid Fast Stain Sputum Smear Images Data Set for Diagnosis of Tuberculosis,” IJCA Proc. Int. Conf. Work. Emerg. Trends Technol. 2013, {ICWET}(1), vol. 8, no. 13, 2013.

J. K. Manarang, “Manarang,” vol. 9, no. 3, pp. 215–221, 2023.

J. Pourbemany, A. Essa, and Y. Zhu, “Real-Time Video-based Heart and Respiration Rate Monitoring,” Proc. IEEE Natl. Aerosp. Electron. Conf. NAECON, vol. 2021-Augus, pp. 332–336, 2021, doi: 10.1109/NAECON49338.2021.9696378.

R. Panigrahi and S. Borah, “Rank of normalizers through TOPSIS with the help of supervised classifiers,” Int. J. Eng. Technol., vol. 7, no. 3.24 Special Issue 24, pp. 483–490, 2018, doi: 10.14419/ijet.v7i1.1.10150.

How to Cite
A. Sholichuddin and M. P. A. T.P, “The Enhancing Accuracy in Mycobacterium Tuberculosis Counting on Acid-Fast Bacteria Sputum through Microscope Camera and Image Processing with Thresholding Method”, Teknokes, vol. 17, no. 1, pp. 79-83, Mar. 2024.
Biomedical Engineering