|
Getting Started with IDL: Images |
|
Images can be rapidly smoothed to soften edges or compensate for random noise in an image using IDL's SMOOTH function. SMOOTH performs an equally weighted smoothing using a square neighborhood of an arbitrary odd width, as shown below.
The previous image looks a bit blurry because it contains only the low frequency components of the original image. Often, an image needs to be sharpened so that edges or high spatial frequency components of the image are enhanced. One way to sharpen an image is to subtract a smoothed image containing only low-frequency components from the original image. This technique is called unsharp masking.
This command subtracts a smoothed version of the image from the original, scales the result, and displays it, as shown previously.
IDL has other built-in sharpening functions that use differentiation to sharpen images. The ROBERTS function returns the Roberts gradient of an image. Enter the following commands:
R=ROBERTS(MYIMAGE)
Another commonly used gradient operator is the Sobel operator. IDL's SOBEL function operates over a 3 by 3 region, making it less sensitive to noise than some other methods. Enter the following commands.
SO=SOBEL(MYIMAGE)
Try loading some of the pre-defined IDL color tables to make this image more visible. While the graphics window is visible, type XLOADCT at the IDL Command Line. The XLOADCT widget application appears. Select a color table from the field; the window will reflect the color scheme. Click "Done" to accept a color table. When you are finished looking at the effects of different tables, click on the first color table in the field, B-W Linear, and click "Done" to load the original black and white color table.
| Note If you load a new color table while an image is still being displayed on a 24-bit (true) color display, you will need to close the image and reload it in IDL in order to see the new image displayed in the new color scheme. In an 8-bit (pseudo) color display however, you will not need to re-display the image as the color change will be immediate. |
IDL Online Help (March 06, 2007)