roipolyaa.m

Select a region of interest with blended (anti-aliased) edges

You are now following this Submission

roipolyaa: Region of Interest Polygon Anti-Aliased.
This function works the same way as roipoly in the image processing toolbox, with one change. Elements along the boundary are shaded, depending on how far across the boundary they are. This removes the stepped edges when being used for image processing, creating a much smoother, antialiased polygon.

The method is as discussed on this blog post:

http://blogs.mathworks.com/steve/2007/02/06/antialiased-polygon-scan-conversion/

The function works in Matlab with no additional toolboxes.

The screenshot shows a mask using 'inpolygon' alone (left) and using roipolyaa (right). At full resolution, the right thumbnail has smoother edges.

It can be quite slow for large masks, especially if strong antialiasing is required. The majority of the time spent on the use of 'inpolygon'. It may be possible to speed this up by using one of the inpolygon replacements here on File Exchange.

Cite As

Andrew Simpson (2026). roipolyaa.m (https://www.mathworks.com/matlabcentral/fileexchange/47190-roipolyaa-m), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.1.0.0

Updated description and tags

1.0.0.0