Finish smoothing fucniton that uses the median method to smooth the image