Image binarization under non-uniform lighting conditions is required in many industrial machine vision applications. Many local adaptive thresholding algorithms have been proposed in the literature for this purpose. However, existing local adaptive thresholding algorithms are either not robust enough or too expensive for real-time implementation due to very high computation costs. This paper presents a new algorithm for local adaptive thresholding based on a multi-stage framework. In the first stage, a mean filtering algorithm, with kernel-size independent computation cost, is proposed for background modeling to eliminate the non-uniform lighting effect. In the second stage, a background-corrected image is generated based on the background color. In the final stage, a global thresholding algorithm is applied to the background-corrected image. The kernel-size independent computation algorithm reduces the order of computation cost of background modeling from NML2 to ML+NL+6NM for an N x M image with an L x L kernel, which enables the real-time processing of objects of arbitrary size. Experiments show that the proposed algorithm performs better than other local thresholding algorithms, such as the Niblack algorithm, in terms of both speed and segmentation results for many machine vision applications under non-uniform lighting conditions.