Thresholding in digital image processing