Mobile app version of vmapp.org
Login or Join
Jamie315

: Convert a line drawing from raster to vector **LINES** Here are already such questions, like: Convert a line drawing from raster to vector What is the best way to convert a series of boxes

@Jamie315

Posted in: #Bitmap #Inkscape #Transform #Vector

Here are already such questions, like:


Convert a line drawing from raster to vector
What is the best way to convert a series of boxes (right angles) from raster to vector?
Converting B&W to vector line art?


... and others.

I have an B&W png image, contains a drawing like an maze, e.g. it contains only lines, no areas.

Need convert it into (any) vector format, but as LINES. Every program what i tried, e.g. VectorMagic, potrace etc. converts the lines into closed path areas.

Small part of the original PNG image - zoomed:


The result of the trace:


As you can see, the "line" is traced from its both side like any other area-like shape.

Looking for a way, how to trace lines into real lines (PATHS), best with the matching line-width. (but would be enough any line with).

The reason behind: need work with the traced lines and nodes, e.g. convert some nodes to bezier and like. Not possible (easily) with shapes.

Any idea:


how to get vectorised lines from any tracing program.
which tool can do this? (any OS - could use Windows, OS X, Linux..)

10.06% popularity Vote Up Vote Down


Login to follow query

More posts by @Jamie315

6 Comments

Sorted by latest first Latest Oldest Best

 

@Hamm6457569

For Inkscape, there is also a centerline trace extension available on github: github.com/Moini/inkscape-centerline-trace (fork of github.com/fablabnbg/inkscape-centerline-trace)

10% popularity Vote Up Vote Down


 

@Kaufman565

I found a good freeware Tool called WinTopo, which for me did the job, i.e. centerline tracking.

The method is called "one touch vectorisation" and works well.

As I come from a GIS context - in the pro version there is an option to Georeference the raster data first - could be useful, not tested yet.

10% popularity Vote Up Vote Down


 

@BetL875

Centerline Tracing

There is a free Open Source tool AutoTrace which is able to perform a centerline trace of a line-art bitmap.



Run AutoTrace with at least the following options:

autotrace -centerline -color-count 2 -output-file output.svg -output-format SVG input.png




We can then fine tune the strokes and add the desired stroke strength..

We may also install the graphical frontend Frontline for AutoTrace in case we are not familiar with the command line.

Binaries for Windows are available from the project's SourceForge page, Linux users may be able to install it from their default repositories.

There are many additional parameters for AutoTrace which can be found in the application's man page or by calling it with autotrace -help.

To rather get straight lines than splines we can e.g. use the following parameters:


-line-threshold [real]:
If a spline does not deviate from the straight line defined by its endpoints by more than the specified number of pixels, then treat it as a straight line (default: 1).
- line-reversion-threshold [real]:
If a spline is closer to a straight line than this, weighted by the square of the curve length, keep it a straight line even if it is a list with curves; default is .01.

10% popularity Vote Up Vote Down


 

@Cugini998

Illustrator can do center line tracing much like autotrace. Its not super useful for most things but in this case the image is highly synthetic and it might work.

Yor source image is notoriously bad so theres no real way to try this without losing quality, your originals should be better (no need to be so zoomed)

Do this:


In trace settings disable fills and enable strokes.
Object → Expand




Image 1: Object after trace and expand.


To further enhance the results from any tracing errors do: Object → Path → Simplify, check straight edges.




Image 2: After simplification


Seems to me your image is somewhat limitted in line directions, and corner locations, if thats true you could now try to quantitze the points for a even better (if not perfect) results.




Image 3: What quantizing might do to the result.

PS: given that the source that you shared is incomplete i would say my result as pretty good. While i agree that in general its not possible to rely on line tracing it would work in this case.

PPS: Your corners are overlapping, this causes auto tracers some grief You could detect and fix these with a few Morphology operators in say ImageMagick that should make tracers MUCH happier.

10% popularity Vote Up Vote Down


 

@Welton168

Try using Interpolate Paths after your trace, as show here:

Average stroke from a fill

10% popularity Vote Up Vote Down


 

@Turnbaugh909

Quite honestly... grab the pen tool and manually trace the paths. It'll result in the best output.

Auto-tracing is often not the best option. When you only want paths you can stroke, auto-trace generally fails miserably.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme