you want mode, not median. there's no reason to think that the background is close to the median colour. that's kinda the whole point of the article...
(median works well if you have symmetrically distributed noise, which is true when denoising astronomy photos, for example, but not here).
(median works well if you have symmetrically distributed noise, which is true when denoising astronomy photos, for example, but not here).