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.

ROI-Based Processing

Define and operate on regions of interest (ROI)

A region of interest (ROI) is a portion of an image that you want to filter or perform some other operation on. You define an ROI by creating a binary mask, which is a binary image that is the same size as the image you want to process. In the mask image, the pixels that define the ROI are set to 1 and all other pixels set to 0.

You can define more than one ROI in an image. The regions can be geographic in nature, such as polygons that encompass contiguous pixels, or defined by a range of intensities. In the latter case, the pixels are not necessarily contiguous.


roipolySpecify polygonal region of interest (ROI)
poly2maskConvert region of interest (ROI) polygon to region mask
regionfillFill in specified regions in image using inward interpolation
roicolorSelect region of interest (ROI) based on color
roifilt2Filter region of interest (ROI) in image
imellipseCreate draggable ellipse
imfreehandCreate draggable freehand region
impolyCreate draggable, resizable polygon
imrectCreate draggable rectangle
imroiRegion-of-interest (ROI) base class


Overview of ROI Filtering

To filter a region of interest (ROI), first define a mask to separate the ROI from the background, then apply the filter to the ROI only.

Create a Binary Mask

A binary mask classifies image pixels as belonging to either the region of interest or the background.

Apply Filter to Region of Interest in an Image

This example shows how to use masked filtering to increase the contrast of a specific region of an image.

Apply Custom Filter to Region of Interest in Image

This example shows how to define your own function and mask to filter a region of interest.

Fill Region of Interest in an Image

The process of filling a region of interest involves replacing all pixels in the region by interpolating inward from the boundary of the region.

Was this topic helpful?