function Vectorize(img: TImage32; compareColor: TColor32; compareFunc: TCompareFunction; colorTolerance: Integer; roundingTolerance: integer = 2): TPathsD;

This function converts monochrome raster images into raw polygon vectors.

compareFunc: usually CompareRGB, CompareHue or CompareAlpha.
colorTolerance: This value will be passed to compareFunc.
roundingTolerance: specifies the minimum distance for adjacent pixels in returned paths.

Vectorize is usually just the first step in completely vectorizing an image. Generally these raw polygon vectors are simplified using RamerDouglasPeucker and then smoothed with SmoothToBezier.

//vectorize an image, filtering on non-transparency or dark colors 
if img.HasTransparency then
  rawPaths := Vectorize(img, $FF000000, CompareAlpha, $80) else  
  rawPaths := Vectorize(img, $FF000000, CompareRGB, $80);

//and simplify the result
simplifiedPaths := RamerDouglasPeucker(rawPaths, 3);
//then smooth the result
bezierPaths := SmoothToBezier(simplifiedPaths, true, TrackBar1.Position, 3);
//and finally flatten and draw the Bezier paths
flattenedPaths := FlattenCBezier(bezierPaths);
DrawPolygon(displayImg, flattenedPaths, frEvenOdd, clNavy32);


See Also

RamerDouglasPeucker, SmoothToBezier, CompareAlpha, CompareHue, CompareRGB