1 year ago

#388991

test-img

SCCCCC

How do I convert image file to vector shapes?

I managed to write code that finds individual shapes from a simple image file (two color image) and saved the pixel coordinate where the shape was first detected (as a starting point for the "vectorization"). Now I'd need to trace the outline of the shapes and set vector for points for the shapes so I can import them to another code project.

I have tried to come up with some methods for doing this, but I feel like all of them are either unnecessarily complicated or very slow. Regardless, none of them have been reliable enough to use.

Here is an example of what how I intended it to work. So, no curves. Only straight lines. Primarily in angles in increments of 45 degrees (or optionally 22.5 degrees) and if there are one pixel shifts sparsely enough, it will treat that as a line at a slight angle. The example of that in the image is very exaggerated. In the actual image I need to process a shift by one pixel happens approximately every 100 - 200 pixels.

So, how do I detect when I'm at a point in the shape where I need to put down a vector point and how do I know which direction to move from there? Or is there a simpler way than trying to trace the outline? It feels like this should be simpler than I'm making it up to begin.

image-processing

vector-graphics

0 Answers

Your Answer

Accepted video resources