Web Based implementation of SquiggleDraw algorithm
 
 
 
 
 
Go to file
Maksim 1ae2248226 Fix conflicts 2019-01-29 00:19:54 -08:00
build using different component 2019-01-29 00:08:45 -08:00
config Initial commmit 2019-01-29 00:08:45 -08:00
examples added image 2018-01-01 18:46:56 -08:00
src Fix conflicts 2019-01-29 00:19:54 -08:00
static Initial commmit 2019-01-29 00:08:45 -08:00
.babelrc Initial commmit 2019-01-29 00:08:45 -08:00
.editorconfig Initial commmit 2019-01-29 00:08:45 -08:00
.gitignore Initial commmit 2019-01-29 00:08:45 -08:00
.postcssrc.js Initial commmit 2019-01-29 00:08:45 -08:00
LICENSE Initial commit 2017-12-17 22:52:31 -08:00
README.md Initial commmit 2019-01-29 00:08:45 -08:00
index.html Fix conflicts 2019-01-29 00:19:54 -08:00
mix-manifest.json Added download button! 2017-12-18 01:37:45 -08:00
package-lock.json switched to Croppa 2019-01-29 00:08:45 -08:00
package.json Fix conflicts 2019-01-29 00:19:54 -08:00
webpack.mix.js Initial commit 2017-12-18 01:10:48 -08:00

README.md

<<<<<<< HEAD

Description

Web Based implementation of SquiggleDraw algorithm, originally implemented by Gregg Wygonik.

The online version of this project takes a picture from your webcam and turns it into plotter-drawable SVG file.

Here's an example of output image generated with this tool:

Image of SquiggleCam in use

And here's my project that uses this tool:

Video of SquiggleCam in use

I'll update the code soon in order to be able to upload images as well as take webcam pictures.

Installation and running

Clone or download this repo, then run this command to get all dependencies installed locally:

npm install

Then, run this command to watch for changes and to launch the HTML page in the browser:

npm run watch

The project uses Laravel Mix for ES6 conversion, file watching, code compression and development process.

Algorithm

The algorithm processes the image in the following way:

Retrieve photo as an array of pixels IMAGE
Set desired number of horizontal lines as LINE_COUNT
Set desired number of vertical spacing as SPACING
Set desired line amplitude as AMPLITUDE
Set desired line rotation frequency as FREQUENCY
For y :=0 to image height step image height / LINE_COUNT do
	Set startx := 0
	Set starty := y
	Create a set of coordinates as [startx, starty]
	For x := 1 to image width step SPACING do
		Get brightness br of the current pixel as average of r,g,b values
		Set r := (255 - br) / LINE_COUNT * AMPLITUDE
		Set a := (255 - br) / FREQUENCY
		Create a set of coordinates as [x, y + Math.sin(a) * r]
Pass the resulting array of coordinates to rendering application

The rendering layer is based on D3.js library which takes an array of points and creates SVG lines that connect those points.

Using the output images

The output SVG file generated with this tool can be uploaded to SVG -> GCODE (or similar) converter in order to be plotted on a pen plotter or engraved on a laser cutter.

image-editor

Image editor

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report

For a detailed explanation on how things work, check out the guide and docs for vue-loader.

Initial commmit