fix for edges artifacts in DistanceTransform