Code Monkey home page Code Monkey logo

threadportraitalgorithm's Introduction

threadPortraitAlgorithm

Making portraits from thread

This algorithm takes as input an image you want to draw, and will output:

  • a series of numbers corresponding to each nail where the thread should be placed (stored in results.txt), and
  • [optional] simulated images of what the result will look like after x iterations

To run the script, call py main.py [args] from the command line with the following arguments:

  • BOARD_WIDTH: width of the board in centimeters
  • PIXEL_WIDTH: suggest keeping this constant and changing board width only
  • LINE_TRANSPARENCY: how many lines overlapped required to reach black (value between 0 to 1)
  • NUM_NAILS: how many nails to place on the board
  • MAX_ITERATIONS: how many thread segments to place before algorithm terminates

threadportraitalgorithm's People

Contributors

jennynotjen avatar decimaelstrom avatar nickodell avatar

Stargazers

Lavin Tom K Abraham avatar Juan Pablo Sarmiento avatar Diego Ricardo Valdivia Arreola avatar Leandro de Oliveira avatar Mhamad avatar Alberto Labarga avatar Mahendrarajan avatar Oğuz Gençer (ゲンチェル オーズ) avatar Trevor Schachner avatar Sarathkrishnan G S avatar arbenede avatar Mohammad Ali Zamani avatar Nikola avatar chunyu.chen avatar Ravi Chandra Reddy N avatar Umer Salman avatar  avatar David Yang avatar Arunachalam avatar  avatar Jose Fernandes avatar  avatar  avatar  avatar August Lukens avatar

Watchers

 avatar

threadportraitalgorithm's Issues

feature request: thread plotter support

Ok, so I don't know if a "thread plotter" exists, but code like the threadPortraitAlgorithm created the need for one. It wouldn't be difficult to covert an open CNC router design (something like this: https://www.thingiverse.com/thing:3004773) to drag around a sewing-machine needle and a spool instead of a router. You see where I'm going with this, right? The intent is to create an open thread-plotter design and Arduino code to drive it, The threadPortraitAlgorithm could create the code to automate the weaving of the thread around the nails, much like a slicer creates the "gcode" to instruct the stepper motors on a 3D printer how to deposit the plastic to replicate a 3D model.

I've already begun working on a 600mm square thread plotter prototype, (parts already in transit) and I'm happy to share any experience and code in the process, and welcome any collaboration. I'm even happy to let @jennynotjen to take the lead and credit for it. (her code started it after-all) I just really want a thread-plotter, so I'm making one! (help is welcome, but not required :)

I'll keep progress posted here.

update: well ok, I see that thread art machines have actually been around for a bit. I still want to make one. Seems like we need to separate the algorithm from anything that would use it (like a CNC threading machine), which means putting the code in classes, and calling the algorithm as a library.

@jennynotjen , would you be okay if we open source this code as a library, and publish it to PyPI for pip install? (https://realpython.com/pypi-publish-python-package/)

LINE_TRANSPARENCY

It seems that use didn't use parameter LINE_TRANSPARENCY nowhere besides the name of the output file. Can you hint please, how to make the lines transparent and then add (not refill the line) line values to the others, so that intersections of the lines will be less transparent?
Thanks in advance

The PIL library

Hello
I am new to programming
Is this code written by Python version 2 or 3?
After I installed the pillow library and other libraries, the following message appeared in the program execution

Traceback (most recent call last):
File "D:\main.py", line 12, in
BOARD_WIDTH = int(args[1]) #CM
IndexError: list index out of range

To solve this problem, I did the following
args = [0, 2000,1 , 1, 300, 4000 ]
in
#GET INPUT CONSTANTS HERE

args = [0, 2000,1 , 1, 300, 4000 ]

args = sys.argv
I added and the program worked
Was my work wrong?
What should I do to improve the quality of the output?

please guide me

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.