GithubHelp home page GithubHelp logo

raster2svg's Introduction

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!).

raster2svg's People

Contributors

sameer avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.