Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

imsharpen

Sharpen image using unsharp masking

Syntax

Description

example

B = imsharpen(A) returns an enhanced version of the grayscale or truecolor (RGB) input image A, where the image features, such as edges, have been sharpened using the unsharp masking method.

example

B = imsharpen(A,Name,Value,...) sharpens the image using name-value pairs to control aspects of unsharp masking. Parameter names can be abbreviated.

Examples

collapse all

Read an image into the workspace and display it.

a = imread('hestain.png');
imshow(a)
title('Original Image');

Sharpen the image using the imsharpen function and display it.

b = imsharpen(a);
figure, imshow(b)
title('Sharpened Image');

Read an image into the workspace and display it.

a = imread('rice.png');
imshow(a), title('Original Image');

Sharpen image, specifying the radius and amount parameters.

b = imsharpen(a,'Radius',2,'Amount',1);
figure, imshow(b)
title('Sharpened Image');

Input Arguments

collapse all

Grayscale or truecolor (RGB) image to be enhanced, specified as a nonsparse, numeric array.

If A is a truecolor (RGB) image, imsharpen converts the image to the L*a*b* colorspace, applies sharpening to the L* channel only, and then converts the image back to the RGB colorspace before returning it as the output image B.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: ‘Radius', 1.5

collapse all

Standard deviation of the Gaussian lowpass filter, specified as a numeric value. This value controls the size of the region around the edge pixels that is affected by sharpening. A large value sharpens wider regions around the edges, whereas a small value sharpens narrower regions around edges.

Example: ‘Radius', 1.5

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Strength of the sharpening effect, specified as a numeric value. A higher value leads to larger increase in the contrast of the sharpened pixels. Typical values for this parameter are within the range [0 2], although values greater than 2 are allowed. Very large values for this parameter may create undesirable effects in the output image.

Example: 'Amount',1.2

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Minimum contrast required for a pixel to be considered an edge pixel, specified as a scalar in the range [0 1]. Higher values (closer to 1) allow sharpening only in high-contrast regions, such as strong edges, while leaving low-contrast regions unaffected. Lower values (closer to 0) additionally allow sharpening in relatively smoother regions of the image. This parameter is useful in avoiding sharpening noise in the output image.

Example: 'Threshold', 0.7

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Output Arguments

collapse all

Image that has been sharpened, returned as a nonsparse array the same size and class as the input image.

More About

collapse all

sharpening

Sharpness is actually the contrast between different colors. A quick transition from black to white looks sharp. A gradual transition from black to gray to white looks blurry. Sharpening images increases the contrast along the edges where different colors meet.

Unsharp masking

The unsharp masking technique comes from a publishing industry process in which an image is sharpened by subtracting a blurred (unsharp) version of the image from itself. Do not be confused by the name of this filter: an unsharp filter is an operator used to sharpen an image.

Introduced in R2013a

Was this topic helpful?