SMOOTHPOLYGON Smooth a polygon using local averaging.
RES = smoothPolygon(POLY, M)
POLY contains the polygon vertices, and M is the size of smoothing
(given as the length of the convolution window).
Example
img = imread('circles.png');
img = imfill(img, 'holes');
contours = bwboundaries(img');
contour = contours{1};
imshow(img); hold on; drawPolygon(contour, 'b');
contourf = smoothPolygon(contour, 11);
drawPolygon(contourf, 'm');
See also
polygons2d, smoothPolyline, simplifyPolygon, resamplePolygon
Package: matgeom