Algorithm and program for calculating evacuation time based on a PDF/image of an evacuation plan and converting it into an object and graph model
DOI:
https://doi.org/10.34121/1028-9763-2025-3-4-109-126Keywords:
PDF parsing, evacuation plan, Computer Vision, OpenCV, OCR, graph model, evacuation time, object-oriented programmingAbstract
Following the previous paper where an evacuation time calculation algorithm was implemented based on manually prepared data, this one formalizes a final end-to-end module for importing a PDF/image evacuation plan and automatically converting it into an object and graph model for further calculations according to DSTU standards. A hybrid Computer Vision pipeline is proposed: vector analysis of PDF objects (lines/polylines/texts/layers); raster branch using OpenCV (HSV segmentation of green «EXIT» signs and arrows, wall detection using LSD/Hough, door detection as local «gaps», morphological skeletonization, and distance transform for estimating the local passage width). The module output consists of a set of objects (exits, doors, stairs, sections, passages) and a directed graph (V, E) with attributes of length and width, directly consumed by the software from the first paper [1]. To evaluate the performance of automatic evacuation plan import, several key factors are considered. First, we check whether the system correctly finds the exits. Next, the accuracy of recognized directional arrows, which indicate movement orientation, is assessed. For corridors, it is important that the generated «passage mask» matches the actual layout. Additionally, the connectivity of the graph is analyzed — whether it is possible to reach an exit from any point — and whether the routes can be fully reconstructed. Moreover, the final outcome, the calculated evacuation time, is evaluated and compared with manual calculations according to the DSTU methodology. Thus, both the correctness of object recognition and the accuracy of the final calculations are verified. The result is the elimination of manual input to the program, reproducibility, and suitability for reporting. The module is integrated with the previously developed object-oriented software (classes Area, EvacuationRoute, Metrics; BFS/DFS), ensuring a full cycle.
References
1. Бєгун В.В., Крук С.В. Розробка програмного забезпечення розрахунку часу евакуації відвідувачів торговельно-розважального центру. Математичні машини і системи. 2024. № 3–4. С. 78–92. DOI: https://doi.org/10.34121/1028-9763-2024-3-4-78-92. URL: http://www.immsp.kiev.ua/ publications/articles/2024/2024_3_4/03_04_24_Begun.pdf.
2. Бєгун В.В. Цифрова економіка та питання безпеки ТРЦ України. Математичні машини і системи. 2023. № 1. С. 60–71.
3. Begun S., Begun V. A SaaS Concept-Based Shopping Center Fire Risk Assessment Model for the Safety Management Applications. International Journal of Reliability, Quality and Safety Engineering. 2024. Vol. 31, N 2. P. 2350036. URL: https://doi.org/10.1142/S0218539323500365. (дата звернення: 10.07.2025).
4. Бєгун В.В., Волошин О.Ф., Бєгун С.В. Оптимізація контролю безпеки торговельно-розважальних комплексів на основі аналізу моделей визначення ризику. Інформаційні технології та комп’ютерне моделювання: матеріали статей міжнар. наук.-практ. конф. (м. Івано-Франківськ, 15–16 грудня 2022 р.). Івано-Франківськ: п. Голіней О.М., 2022. C. 4–6.
5. Національний стандарт України ДСТУ 2272:2006. Пожежна безпека. Терміни та визначення основних понять. Чинний від 2006-10-01. К.: Держспоживстандарт України, 2007. 32 с.
6. ДСТУ 8828:2019. URL: https://zakon.isu.net.ua/sites/default/files/normdocs/dstu_8828_2019.pdf.
7. ДСТУ 8828:2019. Пожежна безпека. Загальні положення. ДП «УкрНДНЦ». URL: http://uas.org.ua.
8. Adobe Systems Incorporated. PDF (Portable Document Format) 1.7 Reference. Sixth Edition. 2006. November. URL: https://archive.org/details/pdf1.7?utm_source=chatgpt.com.
9. Apryse. What’s Inside My PDF? Raster or Vector? URL: https://apryse.com/blog/development/rastervector-text-what-is-inside-pdf.
10. Procore Support. What is the difference between raster and vector content in PDFs? URL: https://support.procore.com/faq/what-is-the-difference-between-raster-and-vector-content-in-pdf.
11. Canny J. A Computational Approach to Edge Detection. IEEE Trans. PAMI. 1986. N 8 (6). P. 679–698.
12. Grompone R. von Gioi, Jakubowicz J., Morel J.-M., Randall G. LSD: a Line Segment Detector. Image Processing on Line. 2012. N 2. P. 35–55. URL: http://dx.doi.org/10.5201/ipol.2012.gjmr-lsd.126 ISSN 1028-9763. Математичні машини і системи. 2025. № 3-4
13. Duda R.O., Hart P.E. Use of the Hough Transformation to Detect Lines and Curves in Pictures. Comm. ACM. 1972. N 15 (1). P. 11–15.
14. Image Recognition in Python: A Comprehensive Guide. URL: https://flypix.ai/blog/image-recognitionin-python/.
15. Borgefors G. Distance Transformations in Digital Images. CVGIP. 1986. N 34 (3). Р. 344–371.
16. OpenCV documentation. URL: https://docs.opencv.org (алгоритми Canny/LSD, морфологія, distance transform, скелетизація згадані в роботі).
17. PyMuPDF (fitz) documentation. URL: https://pymupdf.readthedocs.io.

