Automated Colony-Forming Unit (CFU) Counting of Bacteria Using Digital Image Analysis Through Computer Vision with Python - Ramirez Panca, Mayté Soledad; Castillo Vergara, Francisco Nemecio; Rodriguez Venturo, Sofia Cristina Ana; Alva Mejía, Holger Edison; Loarte Cadenas, Edwin Anibal; Medina Marcos, Katy Damacia; Tuya Castillo, Eladio Guillermo (Innovaciencia, 2026)
Introduction. Quantitative analysis of bacterial growth is essential in microbiological studies, as it enables the evaluation of microbial survival and proliferation rates, facilitating control and manipulation of microbial communities. However, traditional manual counting of colony-forming units (CFUs) on Petri dishes presents major limitations, including  high time and resource consumption, and variability linked to the analyst’s subjectivity. Objectives. This study aimed to develop a Python-based script for efficient and accurate CFU counting using digital images. Materials and Methods. Water samples were collected from supraglacial lakes of the Llaca Glacier (Peru) and inoculated on nutrient agar and R2A media using the spread plate method. Cultures were incubated at 5 °C for 30 days and photographed using a custom-built photographic chamber that standardized image capture. Results. The script, implemented in Google Colaboratory, follows a three-stage process: preprocessing, segmentation, and colony counting. Gaussian adaptive thresholding was selected for segmentation due to its robustness under variable image conditions. The system’s performance was evaluated by comparing automated results with manual counts across 91 images. The method demonstrated high efficiency, achieving an precision of 97% ± 0.12, a recall of 95% ± 1.10, and an F-measure of 96% ± 0.10, with a processing time of only 0.4 seconds per image. Conclusions. These results demonstrate that the system offers a reliable, fast, and low-cost alternative for CFU quantification. Its design is simple and adaptable, making it a replicable tool for microbiological laboratories, especially in resource-limited settings.
Keywords: CFU counting; Bacteria; automation; image analysis; programming