Irregular Webcomic!

Archive     Blog     Cast     Forum     RSS     Books!     Poll Results     About     Search     Fan Art     Podcast     More Stuff     Random     Support on Patreon
New comics Mon-Fri; reruns Sat-Sun
<   No. 2327   2009-06-10   >

Comic #2327

1 {scene: The water cooler}
1 Mercutio: You need to get back out into the dating scene, Ophelia.
2 Mercutio: I didn't want to say it before, but your ex was a sleaze. Somewhere out there is the right guy for you.
3 Ophelia: Honestly, Mercutio, you expect me to take romantic advice from a geek like you?
4 Ophelia: Your idea of a smooth operator is a median filter.
4 Mercutio: Your point?

First (1) | Previous (2326) | Next (2328) || Latest Rerun (2598) | Latest New (5215)
First 5 | Previous 5 | Next 5 | Latest 5
Shakespeare theme: First | Previous | Next | Latest || First 5 | Previous 5 | Next 5 | Latest 5
This strip's permanent URL:
Annotations off: turn on
Annotations on: turn off

noisy pixels A median filter is a type of signal or image processing filter used to reduce the effects of random noise, such as static or speckling.

Imagine an image like a digital photo, but with a bit of noise, or "grain", in it. If you play with digital photos much, you probably know what I'm talking about; if not, there are some good examples on the page I just linked to.

One way to reduce such noise is to do a calculation at each pixel in the image. Imagine taking a block of nine pixels around each pixel (like taking the entire Brady Bunch around the Alice pixel). Take the brightness values of all those nine pixels and sort them in order, then take the middle one of the sorted pixels. That pixel is going to be a reasonable estimate of the average value of the nine pixels, disregarding any effects caused by noise.

For example, imagine your nine pixel block has brightness values like in the first diagram here. It's supposed to be a nice smooth region of grey, slightly brighter at the bottom right, darker at the top left. But the middle pixel is affected by image noise, and has a value much higher than the brightness values of the grey.

If we take the pixel values and sort them in increasing order, we get: 25, 30, 30, 35, 35, 40, 40, 45, 100. The middle of these nine values is 35, so we assign the value 35 to the middle pixel. The result looks like the second image here.

filtered pixels If we'd merely taken the average of these values, we would have got the value 42.5, which would be slightly too bright to fit the smooth grey transition. But by taking the middle (or median) value, the influence of the bright pixel is ignored.

If we apply this sort of median filter all over an image with scattered pixels of noise, we can effectively get rid of the noise. The filtering will also have the effect of slightly distorting the actual image we want to see, but often this is a small price to pay for the removal of distracting noise. The resulting image is significantly smoother than the original.

2022-07-21 Rerun commentary: Of course if you apply a median filter, your argument no longer has any point.

LEGO® is a registered trademark of the LEGO Group of companies, which does not sponsor, authorise, or endorse this site.
This material is presented in accordance with the LEGO® Fair Play Guidelines.

My comics: Irregular Webcomic! | Darths & Droids | Eavesdropper | Planet of Hats | The Dinosaur Whiteboard | mezzacotta
My blogs: (daily updates) | 100 Proofs that the Earth is a Globe (science!) | Carpe DMM (long form posts) | Snot Block & Roll (food reviews)
More comics I host: The Prisoner of Monty Hall | Lightning Made of Owls | Square Root of Minus Garfield | iToons | Comments on a Postcard | Awkward Fumbles
© 2002-2024 Creative Commons License
This work is copyright and is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International Licence by David Morgan-Mar.