Sharpening an Image
Sharpening an image increases the contrast between bright and dark regions to bring out features.
The sharpening process is basically the application of a high pass filter to an image. The following array is a kernel for a common high pass filter used to sharpen an image:

Note
The above array is an example of one possible kernel for a sharpening filter. Other filters may include more weighting for the center point.
As mentioned in the filtering section of this chapter, filters can be applied to images in IDL with the CONVOL function. See High Pass Filtering for more information on high pass filters.
The following example shows how to use IDL's CONVOL function and the above high pass filter kernel to sharpen an image. This example uses the Magnetic Resonance Image (MRI) of a human knee contained within the mr_knee.dcm file in the examples/data directory. Within the original knee MRI, some information is nearly as dark as the background. This image is sharpened to display these dark areas with improved contrast. Complete the following steps for a detailed description of the process.
Example Code
See sharpening.pro in the examples/doc/image subdirectory of the IDL installation directory for code that duplicates this example. Run the example procedure by entering sharpening at the IDL command prompt or view the file in an IDL Editor window by entering .EDIT sharpening.pro.
- Import the image from the
mr_knee.dcmfile: - Initialize the display:
- Create a window and display the original image:
- Create a kernel for a sharpening (high pass) filter:
- Apply the filter to the image:
- Create another window and display the resulting filtered image:
- Create another window and display the combined images:
file = FILEPATH('mr_knee.dcm', $
SUBDIRECTORY = ['examples', 'data'])
image = READ_DICOM(file)
imageSize = SIZE(image, /DIMENSIONS)
WINDOW, 0, XSIZE = imageSize[0], YSIZE = imageSize[1], $ TITLE = 'Original Knee MRI' TVSCL, imageThe following figure shows the original image.
WINDOW, 1, XSIZE = imageSize[0], YSIZE = imageSize[1], $ TITLE = 'Sharpen Filtered Knee MRI' TVSCL, filteredImageThe following figure shows the results of applying the sharpening (high pass) filter. Pixels that differ dramatically in contrast with surrounding pixels are brightened.
WINDOW, 2, XSIZE = imageSize[0], YSIZE = imageSize[1], $ TITLE = 'Sharpened Knee MRI' TVSCL, image + filteredImageThe following figure shows the combination of the sharpened and original images. This image is sharper, containing more information within several regions, especially the tips of the bones.


