Implement Locally Adaptive Thresholding