A method for segmentation of elongated shapes is presented, including two stages: (1) Thinning of elongated shapes into chain coded lines. (2) Extraction of the main features. Thinning process: a square perimeter is developed around each current pixel, initially at level 255, belonging to a line being extracted. THe size of the square is progressively increased until one or more stick(s), frames by background pixels, appear(s) on the perimeter. From the beginning and the final indices of each stick we deduce the Freeman code leading to the following pixel on the line. Generally, two sticks are present on the square perimeter. One corresponds to the backward direction. To discard the non valid stick, each new detected pixel is marked by lowering its value by one shift right. In presence of a fork, or crossing point, there are more than one valid stick: The closest direction to the previous one is chosen; the current pixel is marked and stored in a list of branching points, for later processing. Filtering and segmentation: median filtering of extended codes, obtained from the corrected sums of 4 consecutive Freeman's codes allows to eliminate much of the quantization noise, without altering significant direction changes, and to segment the line into straight segments, arcs and corners.