FOLLOW

NAME
SYNOPSIS
PARAMETERS
DESCRIPTION
EXAMPLE
REFERENCE
AUTHORS
AVAILABILITY
SEE ALSO

NAME

follow - a contour follower

SYNOPSIS

[x,y] = follow(Img)
[x,y] = follow(Img, 4)
[x,y] = follow(Img, 8)

PARAMETERS

Img
binary array, 1 for object and 0 for background (double precision)
x and y
vectors, storing the parametrized contour.

DESCRIPTION

Function follow extracts parametric contours of binary objects. This is useful for further extracting object features such as curvature and bending energy.
It is assumed that Img has only one object.
x and y both store the parametrized contour. That is, (x(i),y(i)) is a point of the contour, where the coordinate system is assumed as starting from bottom-left corner (0,0) to uper-right corner of the image. To get the (row,col) matrix coordinates, use the transformation below:
row = size(Img,'r') - y col = x+1
The second argument is an optional parameter, being 4 or 8 depending if the border following is to be made in 4- or 8-neighborhood sequence, yielding a 4- or 8-connected contour.
follow(Img) equals follow(Img, 8).

EXAMPLE

initial_dir = PWD;
chdir (SIPDIR + 'images');

Img = imread('star.bmp');
xset('window',0)
xbasc()
imshow(Img,2);
[x,y] = follow(Img);
xset('window',1)
xbasc()
plot2d(1:size(x,'*'),x,2);
plot2d(1:size(y,'*'),y,1);

chdir(initial_dir);

REFERENCE

"Shape Analysis and Classification", L. da F. Costa and R. M Cesar Jr., CRC Press, pp. 335-347.

AUTHORS

Ricardo Fabbri <rfabbri@if.sc.usp.br>

AVAILABILITY

The latest version of the Scilab Image Processing toolbox can be found at
http://siptoolbox.sourceforge.net

SEE ALSO

unfollow, gsm, bwborder, curvature