Use adaptive thresholding.