This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Sharpen Region of Interest in an Image

Read a grayscale image into the workspace.

I = imread('pout.tif');

Draw a region of interest over the image to specify the area you want to filter. Use the drawcircle function to create the region of interest, specifying the center of the circle and the radius of the circle. Alternatively, if you want to draw the circle interactively, then do not specify the center or radius of the circle.

hax = drawcircle(gca,'Center',[115 69],'Radius', 60);

Create the mask using the createMask function and specifying the ROI.

mask = createMask(hax);

Define the function you want to use as a filter. This function, named f, passes the input image x to the imsharpen function and specifies the strength of the sharpening effect by using the 'Amount' name-value pair argument.

f = @(x)imsharpen(x,'Amount',3)
f = function_handle with value:

Filter the ROI using the roifilt2 function and specifying the image, mask, and filtering function.

J = roifilt2(I,mask,f);

Display the result.


See Also

| | | |