Skip to content

sameer/raster2svg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

raster2svg

raster2svg codecov

Convert raster graphics into stylistic art renderings. The output of this program is intended for direct use with svg2gcode to draw with a pen plotter.

Demo

Using 4.2.07 Peppers from the SIPI image database:

cargo run --release  -- peppers.tiff -o peppers.svg --style tsp

Peppers comparison

Pipeline

  1. Image preprocessing
    • Derive key (black) using D50 illumination lightness (D65 sRGB to D50 CIELAB)
    • Derive colors by vector projection onto CIELAB or HSL hue + chroma
    • Square pixel values
  2. Do Linde-Buzo-Gray stippling
    • Find Voronoi tesselation with Jump flooding algorithm (JFA)
    • Split stippling points along the cell's second-order moments when they cover too much capacity
    • Remove stippling points when they do not cover enough capacity
    • Calculate cell centroids and move points to them
    • Repeat until no splits/removes occur
  3. Get Delaunay triangulation using spade
  4. Find Euclidean MST with Prim's algorithm using edges from the Delaunay triangulation
  5. Approximate an open-loop TSP path through the points
    • MST to TSP
    • Local Improvement with 4 operators: relocate, disentangle, 2-opt, and link swap
  6. Draw to SVG

References

Grouped by pipeline stage, all of the papers/pages below provided guidance in creating raster2svg.

Notice for lawyers: no papers are hosted here, they are all provided by the authors or from sci-hub.

Preprocessing

Stippling

Voronoi Diagram

MST

TSP

Edges + Hatching

Honorable mentions

There are also some noteworthy papers that while interesting did not directly influence raster2svg (yet!).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

 
 
 

Languages