aschinchon / pencil-scribbles

Create pencil effect drawings from pictures using R

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pencil Scribbles

In this experiment I use an algorithm to solve the Travelling Salesman Problem (TSP) to make a drawing from a picture. It is inspired by this previous one. Briefly, these are the steps:

  • Load the image
  • Transform it to gray scale
  • Obtain a sample of pixels
  • Draw the path obtained solving the TSP for sampled points

Overlapping 250 paths and giving transparency to lines (alpha) the resulting drawing has a pencil effect. For example, if you load this image:

The output is this one:

Getting Started

Prerequisites

The code is R. You will need to install the following packages (if you don't have them already):

install.packages("imager")
install.packages("dplyr")
install.packages("ggplot2")
install.packages("scales")
install.packages("TSP")

More info

A complete explanation of the experiment can be found at fronkonstin

Authors

About

Create pencil effect drawings from pictures using R

License:MIT License


Languages

Language:R 100.0%