A region of interest (ROI) is a portion of an image that you want to filter or operate on in
some way. The toolbox supports a set of ROI objects that you can use to
create ROIs of many shapes, such circles, ellipses, polygons,
rectangles, and hand-drawn shapes. After creation, you can use ROI
object properties to customize their appearance and functioning. In
addition, the ROI objects support object functions and events that you
can use to implement interactive behavior. For example, using events,
your application can execute custom code whenever the ROI changes
position. As a convenience, the toolbox includes a parallel set of
convenience functions for ROI creation. For example, to create a
rectangular ROI, you can use
the corresponding convenience function
For more information about ROIs, see ROI Creation Overview.
A common use of an ROI is to create a binary mask image. In the mask
image, pixels that belong to the ROI are set to
pixels outside the ROI are set to
0. To create a
mask, use the
createMask object functions supported
by most of the ROI objects. You can also create a mask without requiring
an image using the
Starting in R2018b, a new set of ROI objects replaced the previous set of ROI objects. The new objects provide better performance and more functional capabilities, such as face color transparency. With the new objects, you can also receive notification of interactions with the object, such as clicks or movement, using events. Although there are no plans to remove the old ROI objects at this time, switch to the new ROIs to take advantage of the additional capabilities and flexibility. For more information on migrating to the new ROIs, see ROI Migration.
|Assisted freehand region of interest|
|Circular region of interest|
|Crosshair region of interest|
|Cuboidal region of interest|
|Elliptical region of interest|
|Freehand region of interest|
|Line region of interest|
|Point region of interest|
|Polygonal region of interest|
|Polyline region of interest|
|Rectangular region of interest|
|Begin drawing ROI interactively|
|Create freehand ROI on image with assistance from image edges|
|Create customizable circular ROI|
|Create customizable crosshair ROI|
|Create customizable cuboidal ROI|
|Create customizable elliptical ROI|
|Create customizable freehand ROI|
|Create customizable linear ROI|
|Create customizable point ROI|
|Create customizable polygonal ROI|
|Create customizable polyline ROI|
|Create customizable rectangular ROI|
|Fill in specified regions in image using inward interpolation|
|Restore specific image regions using coherence transport based image inpainting|
|Restore specific image regions using exemplar-based image inpainting|
|Select region of interest (ROI) based on color|
|Filter region of interest (ROI) in image|
|Reduce density of points in ROI using Ramer–Douglas–Peucker algorithm|
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.
A binary mask classifies image pixels as belonging to either the region of interest or the background.
This example shows how to use masked filtering to increase the sharpness of a specific region of interest.
This example shows how to define your own function and mask to filter a region of interest.
The process of filling a region of interest involves replacing all pixels in the region by interpolating inward from the boundary of the region.
This example shows how to subsample or reduce the number of points in a
Freehand ROI object.
This example shows the steps need to create a three-point measurement tool using a Polyline ROI
This example shows how to use line ROIs to measure distances in an image.
This example shows how to define a custom wait function that blocks the MATLAB® command line until you finish positioning a rectangle.