roipolyaa.m
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 (2024). roipolyaa.m (https://www.mathworks.com/matlabcentral/fileexchange/47190-roipolyaa-m), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- Image Processing and Computer Vision > Image Processing Toolbox > Image Filtering and Enhancement > ROI-Based Processing >
- Image Processing and Computer Vision > Image Processing Toolbox > Image Filtering and Enhancement > Image Arithmetic >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.