Adaptive thresholding example