Add contour thresholding