Objective Tuberculosis (TB) remains a significant global infectious disease, posing a considerable health threat, particularly in resource-constrained regions. Due to diverse datasets, radiologists face challenges in accurately diagnosing TB using X-ray images. This study aims to propose an innovative approach leveraging image processing techniques to enhance TB diagnostic accuracy within the automatic segmentation and classification (AuSC) framework for healthcare. Methods The AuSC of detection of TB (AuSC-DTB) framework comprises several steps: image preprocessing involving resizing and median filtering, segmentation using the random walker algorithm, and feature extraction utilizing local binary pattern and histogram of gradient descriptors. The extracted features are then classified using the support vector machine classifier to distinguish between healthy and infected chest X-ray images. The effectiveness of the proposed technique was evaluated using four distinct datasets, such as Japanese Society of Radiological Technology (JSRT), Montgomery, National Library of Medicine (NLM), and Shenzhen. Results Experimental results demonstrate promising outcomes, with accuracy rates of 94%, 95%, 95%, and 93% achieved for JSRT, Montgomery, NLM, and Shenzhen datasets, respectively. Comparative analysis against recent studies indicates superior performance of the proposed hybrid approach. Conclusions The presented hybrid approach within the AuSC framework showcases improved diagnostic accuracy for TB detection from diverse X-ray image datasets. Furthermore, this methodology holds promise for generalizing other diseases diagnosed through X-ray imaging. It can be adapted with computed tomography scans and magnetic resonance imaging images, extending its applicability in healthcare diagnostics.