Arc length function of a sampled curve
s = arclength(crv)
s = arclength(crv, circular)
This function computes the numerical arclength at each sample of a curve, as measured from the first sample. The method implicitly interpolates the curve using line segments between each sample.
initial_dir = PWD; chdir (SIPDIR + 'images'); Img = imread('star.bmp'); clf imshow(Img,2); [x,y] = follow(Img); s = arclength([x y], %t); // plot arc length vs sample id to get an idea of the difference clf; plot(s); a = gca(); a.isoview = 'on'; // the last element should equal the perimeter s($), perim(Img) chdir(initial_dir); |
http://siptoolbox.sourceforge.net