POLYGONCURVATURE Estimate curvature on polygon vertices using polynomial fit.

   CURV = polygonCurvature(POLY, M)
   Estimate the curvature for each vertex of a polygon, using polynomial
   fit from the M verties located around current vertex. M is usually an
   odd value, resulting in a symmetric neighborhood.

   Polynomial fitting is of degree 2 by default.
   

   Example
     img = imread('circles.png');
     img = imfill(img, 'holes');
     imgf = imfilter(double(img), fspecial('gaussian', 7, 2));
     figure(1), imshow(imgf);
     contours = imContours(imgf, .5); poly = contours{1};
     poly2 = smoothPolygon(poly, 7);
     hold on; drawPolygon(poly2);
     curv = polygonCurvature(poly2, 11);
     figure; plot(curv);
     minima = bwlabel(imextendedmin(curv, .05));
     centroids = imCentroid(minima);
     inds = round(centroids(:,2));
     figure(1); hold on; drawPoint(poly2(inds, :), 'g*')

   See also
     polygons2d

Package: matgeom