According to the studies developed in advance, there is a crucial problem of doctors analysing computerised images of the chest visually, making a generalised diagnosis for their patients based on their experience, and making mistakes due to the different characteristics of each patient affected by bacteria in their respiratory tract. An infectious disease that has been increasing over the years is pulmonary tuberculosis, which has had around 12.7 million patients infected in 2020, with low-income countries being the main ones affected by this lung disease that is transmitted from person to person, so it cannot be based on the visual experience of the doctor, as this disease causes an increase of bacteria in the bloodstream and damages the alveoli, although there are various methods of detection, they do not provide a complete result on the patient's condition. The aim of this research is to develop a respiratory tract analysis system that will help doctors to detect tuberculosis earlier and more accurately and avoid prolonged infections that could be fatal for patients. The methodology used for this research is based on carrying out a computer analysis of the patient's chest and then carrying out image processing using MATLAB, using its various digital image processing techniques to detect these conditions. According to the system tests, it was observed that the system performs the detection of tuberculosis with an efficiency of 97.40% in its handling, standing out notoriously for its high value of efficiency, in addition to having the precise time for the determination of tuberculosis in the analysis of computerised images. In conclusion, this system can be used in different circumstances of the patient's condition, from the initial symptoms to an advanced stage of the patient's condition.