A region of interest (ROI) is a portion of an image that you want to
filter or operate on in some way. You can represent an ROI as a binary
mask image. In the mask image, pixels that belong to the ROI are set to
1 and pixels outside the ROI are set to
0. The toolbox offers several options to specify
ROIs and create binary masks.
The toolbox supports a set of objects that you can use to create ROIs of many shapes, such circles, ellipses, polygons, rectangles, and hand-drawn shapes. After you create the objects, you can modify their shape, position, appearance, and behavior. For more information about the ROI shapes, see Create ROI Shapes.
Represent ROIs as Geometric Shapes
|Assisted freehand region of interest|
|Circular region of interest|
|Crosshair region of interest (Since R2019b)|
|Cuboidal region of interest (Since R2019a)|
|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|
Create ROI Shapes
|Create customizable freehand ROI with assistance from object edges|
|Create customizable circular ROI|
|Create customizable crosshair ROI (Since R2019b)|
|Create customizable cuboidal ROI (Since R2019a)|
|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|
Customize ROI Shapes
|Begin drawing ROI interactively|
|Reduce density of points in ROI (Since R2019b)|
|Begin drawing ROI from specified point|
|Query if points are located in ROI|
|Bring ROI to front of Axes stacking order (Since R2019a)|
|Block MATLAB command line until ROI operation is finished (Since R2019b)|
Create Mask from ROI
Filter Image Using ROI
|Fill specified regions in image using inward interpolation|
|Restore specific image regions using coherence transport based image inpainting (Since R2019a)|
|Restore specific image regions using exemplar-based image inpainting (Since R2019b)|
|Select region of interest (ROI) based on color|
|Filter region of interest (ROI) in grayscale image|
|Reduce density of points in ROI using Ramer–Douglas–Peucker algorithm (Since R2019b)|
- Specify ROI as Binary Mask
You can create a binary mask by selecting pixels based on intensity values or position, or by using binary segmentation techniques.
- Create ROI Shapes
ROI objects represent ROIs as geometric and hand-drawn shapes.
- Create Binary Mask Using an ROI Function
This example shows to create a binary mask using one of the ROI creation functions, such as
drawcircle, with the mask creation function
- Classify Pixels That Are Partially Enclosed by ROI
Learn how many Image Processing Toolbox™ functions classify pixels that are only partially within the boundaries of a region of interest.
- 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.
- Sharpen Region of Interest in an Image
This example shows how to use masked filtering to increase the sharpness of a specific region of interest.
- 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.
Create Interactive ROIs Using Events and Callback Functions
- Subsample or Simplify a Freehand ROI
This example shows how to subsample or reduce the number of points in a
- Rotate Image Interactively Using Rectangle ROI
This example shows how to rotate an image by using a Rectangle ROI with a callback function that calls
imrotatewhen you move the ROI.
- Use Polyline to Create Angle Measurement Tool
This example shows how to create an interactive tool that displays the angle between three vertices in a polyline ROI.
- Measure Distances in an Image
This example shows how to use line ROIs to measure distances in an image.
- Use Wait Function After Drawing ROI
This example shows how to define a custom wait function that blocks the MATLAB® command line until you finish positioning a rectangle.