基于 ROI 的处理
定义感兴趣的区域 (ROI) 并对其执行运算
感兴趣的区域是您要以某种方式对其进行滤波或运算的部分图像。您可以将 ROI 表示为二值掩膜图像。在封装图像中,属于感兴趣区域的像素设置为 1
,感兴趣区域外的像素设置为 0
。工具箱提供了几个选项来指定 ROI 和创建二值掩膜。
工具箱支持一组对象,您可以使用这些对象创建许多形状的 ROI,例如圆形、椭圆形、多边形、矩形和手绘形状。创建对象后,您可以修改其形状、位置、外观和行为。有关 ROI 形状的详细信息,请参阅Create ROI Shapes。
函数
主题
指定 ROI
- 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. - 使用 ROI 函数创建二值掩膜
此示例说明如何将 ROI 创建函数(如drawcircle
)和掩膜创建函数createMask
结合使用来创建二值掩膜。 - 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.
对 ROI 进行滤波
- 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.
使用事件和回调函数创建交互式关注区域
- Subsample or Simplify a Freehand ROI
This example shows how to subsample or reduce the number of points in aFreehand
ROI object. - Rotate Image Interactively Using Rectangle ROI
This example shows how to rotate an image by using a Rectangle ROI with a callback function that callsimrotate
when 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.