# Vectorisation

### Stages of Vectorisation

WinTopo employs a two stage vectorisation process:
1. Thinning of the raster image to single pixel width lines.
2. Extraction of real vectors from the pixel lines.

#### Thinning

In order for WinTopo to extract vectors from a raster image it needs to determine which parts of the image constitute lines, and where those lines start and end. For example, the lines may be fairly obvious to a human observer, until the image is magnified, at which point it may be seen that the lines are several pixels wide, uneven along the edges and fade out into the background.

The approach used by WinTopo is to reduce thick or blobby regions down to single pixel width items, so that the image is transformed into lines of pixels. This process is called thinning.

WinTopo provides 5 thinning methods, each utilising different mathematical algorithms and producing different results:

1. Stentiford Thinning
2. Zhang Suen Thinning
3. Best Combination [Not in Freeware version]
4. Simple Edge detection [Not in Freeware version]
5. Canny Edge detection
The Stentiford and Zhang Suen methods both produce pixels lines at the centre of thick regions, whereas the Simple and Canny Edge methods produces pixels at the edges of thick regions.

 The Stentiford method tends to produce lines that follow curves very well, resulting in vectors that most accurately reflect the orginal image. The Zhang Suen method tends to be better at extracting straight lines from a raster, so may result in more desirable vectors from an original image which comprises mainly straight lines. The Best Combination method uses some of the theory from the Zhang Suen method and some from the Stentiford method. It tends to be better with angular corners than the two separate methods, whilst retaining good straight line recognition and smooth curves. This thinning method will shorten some lines, which may be undesirable for certain drawings. The simple Edge Detection method looks for the edges of objects, and so can be very useful for images with solid regions, where you only want to vectorise the outlines. This method works best for images with high contrast edges. It will find the boundary between dark objects and the lighter background. This method does not fully thin the image, so it is often necessary to run a Stentiford, Zhang Suen or Best Combination thinning after performing the edge detection. Unlike the Canny method, this edge detection process uses no additional memory. The Canny edge detection method looks for the edges of objects, and so can be very useful for images with solid regions, or photographic images, where you only want to vectorise the outlines. The Canny method employs more mathematics than the simple edge detection method, and there are optional settings which can improve the results. This method will attempt to find boundaries between poorly defined objects as well as hard edges. The Canny method does not fully thin the image, so it is often necessary to run a Stentiford, Zhang Suen or Best Combination thinning after performing the edge detection. NOTE: the Canny method uses a lot of memory during processing, so may not be appropriate for very large rasters, or if memory is low.

With WinTopo Pro the colour of the original raster is propagated onto the thinned image, whereas WinTopo Freeware always produces a black and white thinned image.

Related Topics: