Added local mean and median filtering