Lab Contents
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.
If you are using a vanilla version of ImageJ from the
website, you need to add the drawing
tools. Alternatively, use Process / Noise / Salt and Pepper
to add some black & white dots to the image, then try the median
filter (radius 1.0)
These first steps to demonstrate the median filter are from the NIH Image
manual.
- 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.
(if
you use the spraycan macro, the tool looks like this
)
- Set the spray can diameter to 250 pixels. (It
is set already to 50, which works fine. To set the width, double-click
on the tool.)
- 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 black 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
/ Duplicate.
- 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
sharpened origina.
- Try the Sharpen filter. Process
-> Sharpen menu.
Sharpened Median filtered image. |
Shapened original. |
 |
 |
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.