Image smoothing, VC++ implementation