Unsharp Mask Filtering - Java Tutorial

Enhancing the overall sharpness of a digital image often has the effect of revealing fine details that cannot be clearly discerned in the original. The unsharp mask filter algorithm is an extremely versatile sharpening tool that improves the definition of fine detail by removing low-frequency spatial information from the original image.

This interactive tutorial explores how the unsharp mask filter algorithm is utilized to sharpen details in a variety of digital images. The tutorial initializes with a randomly selected specimen image (captured in the microscope) appearing in the left-hand window entitled Specimen Image. Each specimen name includes, in parentheses, an abbreviation designating the contrast mechanism employed in obtaining the image. The following nomenclature is used: (FL), fluorescence; (BF), brightfield; (DF), darkfield; (PC), phase contrast; (DIC), differential interference contrast (Nomarski); (HMC), Hoffman modulation contrast; and (POL), polarized light. Visitors will note that specimens captured using the various techniques available in optical microscopy behave differently during image processing in the tutorial.

Adjacent to the Specimen Image window is a Filtered Image window that displays the results of applying the unsharp mask filter algorithm to the original image. To operate the tutorial, select an image from the Choose A Specimen pull-down menu, and adjust the Standard Deviation and Weighting Value sliders until the image appears sharper with enhanced detail.

The unsharp mask filter algorithm involves subtraction of an unsharp mask from the specimen image. An unsharp mask is simply a blurred image that is produced by spatially filtering the specimen image with a Gaussian low-pass filter. This filter can be considered as a convolution operation on an image with a kernel mask that is a two-dimensional Gaussian function (g(x,y); as defined in Equation 1): The size of the Gaussian kernel mask is a function of the parameter σ, and the size of the kernel mask determines the range of frequencies that are removed by the Gaussian filter. In the tutorial, the Standard Deviation slider determines the value of σ in pixels. In general, increasing the size of the kernel mask causes the Gaussian filter to remove a greater number of spatial frequencies from the unsharp mask image. The unsharp mask is then subtracted from the original image according to the equation: In Equation 2, the function F(x, y) represents the brightness value of a pixel at the coordinate (x, y) in the filtered image, and I(x, y) and U(x, y) represent the brightness values of the corresponding pixels in the original and unsharp mask (blurred) images, respectively. The constant c controls the relative weightings of the original and blurred images in the difference equation. In the tutorial, the Weighting Value slider can be used to control the value of c within the range of 1 (the zero percent position), to 5/9 (0.556) at the 400 percent filtering level. Similarly, the Standard Deviation slider determines the standard deviation (measured in pixels) of the Gaussian function utilized to generate the kernel mask.

The equation presented above (Equation 2) demonstrates that an unsharp mask filter operates by subtracting appropriately weighted parts of the unsharp mask from the original image. Such a subtraction operation enhances high-frequency spatial detail at the expense (attenuation) of low-frequency spatial information in the image. This occurs because high-frequency spatial detail removed from the unsharp mask by the Gaussian filter is not subtracted from the original image. In addition, low-frequency spatial detail that is passed by the Gaussian filter (to the unsharp mask) is almost entirely subtracted from the original image. This explains why increasing the size of the Gaussian filter mask usually causes the unsharp mask filter to produce a sharper image.

One of the primary advantages of the unsharp mask filter over other sharpening filters is the flexibility of control, because a majority of the other filters do not provide any user-adjustable parameters. Like other sharpening filters, the unsharp mask filter enhances edges and fine detail in a digital image. Because sharpening filters also suppress low frequency detail, these filters can be used to correct shading distortion throughout an image that is commonly manifested in the form of slowly varying background intensities. Unfortunately, sharpening filters also have the undesirable side effect of increasing noise in the filtered image. For this reason, the unsharp mask filter should be used conservatively, and a reasonable balance should always be sought between the enhancement of detail and the propagation of noise.

#### Contributing Authors

Kenneth R. Spring - Scientific Consultant, Lusby, Maryland, 20657.

John C. Russ - Materials Science and Engineering Department, North Carolina State University, Raleigh, North Carolina, 27695.

Matthew Parry-Hill, Thomas J. Fellers, and Michael W. Davidson - National High Magnetic Field Laboratory, 1800 East Paul Dirac Dr., The Florida State University, Tallahassee, Florida, 32310.
{"ft_lang_label":"__label__en","ft_lang_prob":0.88020486,"math_prob":0.8486555,"size":4838,"snap":"2023-14-2023-23","text_gpt3_token_len":927,"char_repetition_ratio":0.16570129,"word_repetition_ratio":0.027137043,"special_character_ratio":0.18230674,"punctuation_ratio":0.08795181,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9531289,"pos_list":[0,1,2,3,4],"im_url_duplicate_count":[null,2,null,2,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-05-31T00:37:45Z\",\"WARC-Record-ID\":\"<urn:uuid:1e8f82c3-ecfe-4287-b624-fe76d0446bc2>\",\"Content-Length\":\"51061\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:c3975df7-89f7-46e8-87e2-177bed9b43f8>\",\"WARC-Concurrent-To\":\"<urn:uuid:b56976a1-29e2-42f1-a301-0d5eb08a39f5>\",\"WARC-IP-Address\":\"173.255.252.125\",\"WARC-Target-URI\":\"https://www.olympus-lifescience.com/en/microscope-resource/primer/java/digitalimaging/processing/unsharpmask/\",\"WARC-Payload-Digest\":\"sha1:E4H4JTMQLUDUUH23KF3GUXALCRCCXQMS\",\"WARC-Block-Digest\":\"sha1:YFBKTBTIWQJH37WTR7EJQX7SF5NP3MAH\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-23/CC-MAIN-2023-23_segments_1685224646181.29_warc_CC-MAIN-20230530230622-20230531020622-00527.warc.gz\"}"}