This content is licensed under Creative Commons Attribution/Share-Alike License 3.0 (Unported). That means you may freely redistribute or modify this content under the same license conditions and must attribute the original author by placing a hyperlink from your site to this work https://planetcalc.com/9331/. Also, please do not modify any references to the original work (if any) contained in this content.
The calculator below processes the loaded image with a median filter. The calculator allows you to set the size of the filter kernel - 3x3, 5x5, or 7x7. A median filter is usually used to remove "noise" from an image. You can read more about how the median filter works under the calculator.
For each processed pixel of the source image
- calculate the luminosities of the neighbor pixels of the filter kernel (a square area that includes the processed pixel)
- sort the luminosities in the numerical order
- assign the median value (the value from the middle of the array) to the processed pixel in the resulting image
The median value is considered to be a more reliable "average" value for the color of the area than the actual average value since it is not affected by a random "noisy" pixel with a very different luminance value. And since the new pixel value is one of the existing values in the area, the use of this filter does not give unrealistic pixels on sharp color transitions at the boundaries of objects.