Here is a simple example how median filter works.

median

cat