Edge-preserving smoothing and applications