contour_following

CONTOUR_FOLLOWING takes a B&W image, returns the sorted contour points.
3.8K Downloads
Updated 21 May 2007

No License

C = CONTOUR_FOLLOWING(BW) takes BW as an input. BW is a binary array containing the image of an object ('1': foreground, '0': background). It returns a circular list (N x 2, C(1,:)=C(end,:)) of the (row,column)-coordinates of the object's contour, in the order of appearance (This function was inspired from the freeman contour coding algorithm).

Note:
- if the object is less than 3 pixels, CONTOUR_FOLLOWING sends back [0 0].
- the algorithm is quite robust: the object can have holes, and can also be only one pixel thick in some parts (in this case, some coordinates pair will appear two times: they are counted "way and back").

This function was originally developed in order obtain an initialization for a snake algorithm.

The .zip files contains some example images and a test script.

Cite As

Francois Mourougaya (2026). contour_following (https://www.mathworks.com/matlabcentral/fileexchange/14947-contour_following), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux
Version Published Release Notes
1.0.0.0

Corrected a minor bug.