function Vectorize(img: TImage32; compareColor: TColor32; compareFunc: TCompareFunction; tolerance: Integer): TArrayOfArrayOfPointD;

This function converts monochrome raster images into raw polygon vectors. This is usually just the first step in completely vectorizing an image. Typically these raw polygon vectors are simplified using RamerDouglasPeucker and then smoothed with SmoothLine.

//vectorize an image filtering either for non-transparency or for 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);
//and smooth the result
bezierPaths := SmoothLine(simplifiedPaths, true, TrackBar1.Position, 3);
//now finally flatten and draw the Bezier paths
flattenedPaths := FlattenCBezier(bezierPaths);
DrawPolygon(displayImg, flattenedPaths, frEvenOdd, clNavy32);


See Also

RamerDouglasPeucker, SmoothLine