ported histeresis thresholding