[Image-SIG] Remove noise from high ISO photos

Douglas Bagnall douglas at paradise.net.nz
Wed Dec 19 23:38:03 CET 2007

Daniel Felix Ferber wrote:

> When taking a photo with high ISO on a digital camera, there will be
> many pixels that have a random color that is completely different color
> from the expected one. But the photo still has a good sharpness
> ImageMagic uses a stategy that is similar to the median filter: it looks
> at the neighborhood o a pixel. If the color of the pixel is considerably
> different from the color of adjacent pixels, then the color of the pixel
> is changed to a color close to the neighborhood. If not, the pixel is
> preserved.
> It seems that the median filter always changes the color of the pixel,
> and I am afraid that the image might loose sharpness.

What you are describing could be achieved thus:

1. Take a 3x3 median image. Most pixels will hardly be changed, but the
noisy ones will be.

2. find the difference between the original and the median (using
ImageChops.difference). Good pixels will be black or nearly so, but the
noisy ones won't be.

3. Use the difference image as a mask for pasting the median over the
original.  You will need to convert the difference image to grey-scale
in some way, or split it into bands and do each band of the image
separately. image.convert('L') is probably not the best way. You might
want to make it into a threshold image (rather than have it blending
proportionately to the difference).

But I'm not sure how much better than a simple median it will be--after
all, the pixels that this process doesn't change are exactly the pixels
that the median hardly changes.

In any case, the median will be much better than SMOOTH and SMOOTH_MORE.


More information about the Image-SIG mailing list