The median filter takes in the neighbourhood the median color (see [[wp:Median filter|Median filter]])

''(to test the function below, you can use these [[Read_ppm_file|input]] and [[Write_ppm_file|output]] solutions)''

