Main Content

Overview of ROI Filtering

Filtering a region of interest (ROI) is the process of applying a filter to a region in an image, where a binary mask defines the region. For example, you can apply an intensity adjustment filter to certain regions of an image.

To filter an ROI in an image, use the roifilt2 function. When you call roifilt2, specify:

  • The input grayscale image to be filtered

  • A binary mask image that defines the ROI

  • A filter (either a 2-D filter or function)

roifilt2 filters the input image and returns an image that consists of filtered values for pixels where the binary mask contains 1s and unfiltered values for pixels where the binary mask contains 0s. This type of operation is called masked filtering.

roifilt2 is best suited for operations that return data in the same range as in the original image, because the output image takes some of its data directly from the input image. Certain filtering operations can result in values outside the normal image data range (that is, [0, 1] for images of class double, [0, 255] for images of class uint8, and [0, 65535] for images of class uint16).

See Also

Related Topics