Giter Site home page Giter Site logo

weaver's Introduction

Weaver

The idea is to take an image and come up with data to weave it using a single thread on a circular rim.

Basically this: A picture is worth a thousand words. Work by Petros Vrellis

Actual result

Output Input
Output Input

No. of pins: 254

No. of lines: 4000 (Approx. 1.75 km thread)

Credit: @larryisgood

Screenshots

Multiple colors

Color Circle Frame

Grayscale

Circle Frame Square Frame

Basic algorithm

This piece of software requires 3 inputs from the user:

  • A picture to be drawn
  • Total points/nails on a circular rim, P
  • Total lines to be drawn, L

All three inputs are crucial on how the final result is going to look. The program does the following:

  1. Converts the color picture to grayscale.
  2. The picture is then cropped to a square.
  3. Places a virtual circular rim with P equidistant points on it.
  4. Takes the first point (p = 0) as the starting point.
  5. Finds the next point p' to draw a line from point p by finding the highest intensity line.
    • The intensity of a line is calculated by adding up the all the pixel values of a line from p to p'.
  6. A new line is drawn from p to p' on the circular rim.
  7. The original image is modified such that the pixels under the line from p to p' are lightened* so that the same line is not drawn next time.
  8. p' is set as the new starting point p and then the steps from 5 is repeated until L lines are drawn.

* The amount by which a line should be lightened can also be configured.

How to run?

  • You'll need to download Processing. It's available for Windows / Mac / Linux.
  • Open up Weaver.pde using Processing.
  • Hit Run or press CTRL+R to execute the application.
  • Click anywhere on the application to start processing.
  • Click again to pause.
  • After the process is complete, a text file will be generated. This file contains the positions of each point where the thread should be knitted next.

Note: Those of you who are downloading the repository as .zip file, you must rename the folder Weaver-master to Weaver before opening on Processing.

Configuration

The setup() function in Weaver.pde chooses one of the example configurations. Check the example.pde to modify the configuration of each example.

Credits

Kudos to i-make-robots for originally writting this algorithm.

I changed it a little bit to clean up the code, improve GUI and add some extra features.

weaver's People

Contributors

alyyousuf7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

weaver's Issues

Weaver doesn't run

Followed the instructions in Readme section, but when processing stops on line 10 "Frame frame" and adds the remarque:
You may need to add "import java.awt.Frame;" to the top of your sketch.
To make sketches more portable, imports that are not part of the Processing API were removed in Processing 2.
See the changes page for more information: https://github.com/processing/processing/wiki/Changes
Cannot find a class or type named “Frame”

Where do I have to put the subject (picture), "P" and "L"?

Error

When Running it appears cannot find a class or type named "Frame"

Color variant support

Many people have requested color variant support on Weaver.

https://www.saatchiart.com/art/New-Media-Color-knit-5-Limited-Edition-of-4/858823/6200223/view

Let's discuss here the possible solution to the issue.

Some of the discussion are in #1, and from now on we'll be using this issue to follow up.

[Update]
You can create color variant output using Example03 code in the master branch. You have to choose the colors very meticulously. It can be a real pain to choose correct colors.
Keeping the issue opened until we find a better approach to automatically pick colors. [I hope that's possible]

README Clarifications & Project Help

Hey @alyyousuf7, thank you for providing your code for this!

I would like to use this to create a portrait and I have a couple of questions that would make it an easier process for me. I would be very grateful if you had the time to answer them.

  1. Where is point 0 located? (very top?)
  2. Is point 1 clockwise or counterclockwise from point 0?
  3. When constructing the frame, how large is it intended to be? Seems related to the next question:
  4. How might drawAlpha relate to the thickness of thread used in real life?
  5. Can you explain the intention behind jump? I'm getting very different results from changing it, but I don't fully understand why.
  6. Does removeColor do anything if the image is already black and white?

Thanks!

rectangular frame

Hi
I tried a lot, but I couldn't create a rectangular frame
Help me please

Problem with result!

Computer version and real knitted version no match. Real knitted version getting very dark than program version. What size of image need to be for knitting portrait on the cyrcle with 50 cm diameter. What should be int cropped_size = 640 and image resolution.
For example i have image 2000x2000 pixels, need i crop image for knitting cyrcle frame with 50 cm diameter?

Number of hooks

Is there any way to change the number of hooks/points around the circumference?

Color version +

Is it possible..
100 black
100 red
100 black
100 red
.... Without creating new layer.

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.