GithubHelp home page GithubHelp logo

robotums / pytspart Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rescience-archives/rougier-2017

10.0 1.0 3.0 159.87 MB

Easy to use and fast TSP art generation with weighted Voronoi Stippling.

License: MIT License

TeX 1.21% Makefile 0.13% Python 2.35% Jupyter Notebook 96.31%

pytspart's Introduction

Features of This Repo:

1. Travelling Salesperson Art

gets converted to:

2. Weighted Voronoi Stippling

This is a replication of the following article:

Weighted Voronoi Stippling, Adrian Secord. In: Proceedings of the 2nd International Symposium on Non-photorealistic Animation and Rendering. NPAR ’02. ACM, 2002, pp. 37– 43.

where the author introduced a techniques for generating stipple drawings from grayscale images using weighted centroidal Voronoi diagrams as in the traditional artistic technique of stippling that places small dots of ink onto paper such that their density give the impression of tone.

Setup:

This replication has been written and tested on OSX 10.12 (Sierra) using the following packages:

  • Python 3.6.0
  • Numpy 1.12.0
  • Scipy 0.18.1
  • Matplotlib 2.0.0
  • tqdm 4.11.2
  • Pillow 4.0.0
  • Imageio 2.9.0

Setup Instructions (for TSP):

  1. Make a venv for this repo (recommended). Python 3.5+ works best: python3 -m venv TSP

  2. activate the venv and use pip to install the following: pip3 install numpy pandas matplotlib Pillow cython

  3. You'll need the concorde TSP solver -- one of the most powerful TSP solvers around, and to get in it python, you'll have to do the following: a. clone the python wrapper library

git clone https://github.com/jvkersch/pyconcorde
cd pyconcorde

b. run pip install (dont forget the period). This may take a minute.

pip3 install -e .

c. verify installation. open up the python interpreter and type: from concorde.tsp import TSPSolver And make sure it doesn't fail.

Usage

usage: generate_tsp.py [-h] filepath

positional arguments:
  filepath    location of source image

optional arguments:
  -h, --help  show this help message and exit

usage: tsp.py [-h] [--time_bound n] [--verbosity bool] [--norm str] [--save]
              [--display] [--output_filename OUTPUT_FILENAME]
              .dat/.npy filename

TSP art from stippled image generator

positional arguments:
  .dat/.npy filename    location of .dat/.npy filename, output of stipple.py

optional arguments:
  -h, --help            show this help message and exit
  --time_bound n        Upperbound for TSP solver to find solution.
  --verbosity bool      Verbosity of TSP solver.
  --norm str            edge weight for TSP solver
  --save                Save computed points
  --display             Display final result
  --output_filename OUTPUT_FILENAME
                        Solved filename
 usage: stippler.py [--n_iter n] [--n_point n] [--save] [--force]
                    [--pointsize min,max] [--figsize w,h]
                    [--display] [--interactive] file

 Weighted Vororonoi Stippler

 positional arguments:
   file                  Density image filename

 optional arguments:
   -h, --help            show this help message and exit
   --n_iter n            Maximum number of iterations
   --n_point n           Number of points
   --pointsize (min,max) (min,max)
                         Point mix/max size for final display
   --figsize w,h         Figure size
   --force               Force recomputation
   --save                Save computed points
   --display             Display final result
   --interactive         Display intermediate results (slower)

For more info:

Check out Opt Art: From Mathematical Optimization to Visual Design by Robert Bosch.

pytspart's People

Contributors

rougier avatar robotums avatar antoine-lizee avatar pdebuyl avatar daniel-mietchen avatar jvamvas avatar

Stargazers

RITHIGA S avatar  avatar Ella Jameson avatar  avatar Shuai Liang avatar Andrés Duque Bran avatar Muthukrishnan avatar Philip Kamenarsky avatar Open Close avatar  avatar

Watchers

James Cloos 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.