How can I convert set of points that (we can assume) create line made of segments (Top Image) to vector line (Bottom image)?
Is there some algorithm for that? Preferably C++ but even pseudocode will be ok.
How can I convert set of points that (we can assume) create line made of segments (Top Image) to vector line (Bottom image)?
Is there some algorithm for that? Preferably C++ but even pseudocode will be ok.
Here's how I would approach it:
Create contour/outline of raster image
Use these points as a vector contour/outline
Split the points in half so you have a line that describes the top edge and a line that describes the bottom edge of original outline
Take the bottom line (or top line) and use a line simplification algorithm (like Reumann-Witkam or Douglas-Peucker) to get a simplified vector line
Work out how much to offset the line by so it is roughly centered between the original two contour halves.
This should give you reasonable results without much computational complexity.