Removing Shot noise from Face Image.
The median filter is very good at removing shot noise (but not perfect).
We will compare it with the mean filter, and look for artifacts of smoothing.
These first steps to demonstrate the median filter are from the NIH Image
- With File / Open, load Sample Images / Filter Samples / Face.tiff
- (PC: You might have to move the image a bit to
the right to uncover the tool.)
- Click on the zoom (magnifying glass) tool .
Then click once on the image. A zoom factor of x2 will clearly show
what is going on. (PC: Scion 1.61 - you might have to
enlarge the window by mousing the lower right corner, to view the entire image.)
- Control-click with the magnifying glass to zoom down.
- Double click on the spray can tool.
- Set the spray can diameter to 250 pixels.
- You do not need to change the diameter - it is
already sufficiently large.
- Click on the black bar
in the LUT window to set the drawing color to black. This
bar is not available in ImageJ. To set the drawing color to black, click
on the color picker (eye dropper tool) ,
then click on a black area of the image.
- Holding the mouse down, move the spray can tool over the image spattering
black pixels on it.
- If you don't spray too much, so that all (or most of) the pixels are
isolated, then the median filter will completely remove them.
| Here is a piece of the image.
- Click on the white bar and
spray again. Again, use the color picker to set the
drawing color to white.
| You can spray with any gray level and the filter will still work.
- Duplicate the image with the File -> Duplicate menu. Use Image
- Apply the median filter to one of the images.
- Process -> Rank Filters ... menu, click the Median (reduce
noise) filter, use 1 iteration.
- Process / Noise / Despeckle or Process / Filters
/ Median (radius = 1 is the same as despeckle).
Most of the noise spots should be removed - the noise pixels are
too close together in any small area, some noise pixels may remain.
The filtered image looks almost the same as the original, if both are
not zoomed. The zoomed image shows a slight degree of smoothing eg. the
gray hairs in the beard loose detail.
Image processing on filtered images will often enhance artifacts. Note
the difference below between the sharpened median filtered image and the
- Try the Sharpen filter. Process
-> Sharpen menu.
Sharpened Median filtered image.
The median filter is distinctly better at removing shot noise than is
the mean filter. This 3x3 mean filter (using the Smooth menu with the option
key held down) replaces a pixel in the center of a 3x3 pixel square with
the average value of all of the pixels within the square. The median filter
replaces the center pixel with the median value.
- Mean filter the copy of the noisy
image using the Process -> Smooth menu with the option key held
down. (Keys don't modify the filter.)
| If the option key is not held down, less smoothing is done - the image
is less blurry, but the noise pixels are very prominant.
|| This is the image to the left, sharpened with the Process ->
Sharpen menu, option key not held down..|
Note that the Smooth and Sharpen operations are not inverses of each
other - one undoes the other almost - but not completely.