Tuberculosis (TB) remains a serious global health problem, especially in regions with limited access to expert medical care. While chest X-rays are widely used for TB screening, interpreting them accurately can be challenging. This work introduces an automated system that helps detect TB from X-ray images using advanced image processing and artificial intelligence. The system first enhances and isolates the lung areas using the nnU-Net model, then analyzes them with a Swin Transformer to identify signs of infection. Tests on well-known datasets, such as Shenzhen and Montgomery County, showed excellent performance, achieving 95.2% accuracy and a Dice score of 0.94. Overall, this approach offers a reliable and scalable tool that could support faster and more consistent TB diagnosis, particularly in resource-limited healthcare settings.