Computer-Designed Portraits, Knit By Hand!

Artist [Petros Vrellis] has done something that we’ve never seen before: his piece “A New Way to Knit” lives up to its name. What he’s done is to take the traditional circular loom, some black thread, and toss some computing at it. And then he loops the string around and around and around.

a-new-way-to-knit-175653201mp4-shot0009_thumbnail

The end result of following the computer’s instructions is a greyscale portrait. Where few black strings overlap, it’s light, and where more overlap, it’s darker. That’s the whole gimmick, but the effect is awesome. As you zoom in and out, it goes from a recognizable face to a tangle of wires and back. Check out his video embedded below.

There’s at least a few ways to do this, so we e-mailed [Petros] to ask. He assigned darker pixels in the original image a higher score, and ran the string to the opposing pin that maximizes the sum of the pixels passed through. With each string, he subtracted off a bit of darkness from all of the pixels along the string’s path, and repeated, starting each time at the new pin location. Each string has “only” 200 choices to make times 3000-4000 passes, so a computer should be done in no time. Tuning this algorithm to work just right, and look good with real string is probably just about as easy as it sounds. For instance, he had to include code to break ties.

Although we love the man-machine cooperation on the piece, [Petros] mentioned that he’s tempted to automate the weaving. Check out his two pendulum-based pieces (here, and here) if you like more machines in your art.

While on the topic of portraits made with black string, we have to remind you of this previous art piece that does all the work of actually laying the string out by using a modified 3D printer. Beauty is in the eye of the beholder, but we have to say that if art were judged on a difficulty scale, [Petros] would win for using only a circular loom. Never mind that he did it all by hand.

74 thoughts on “Computer-Designed Portraits, Knit By Hand!

  1. What a clever idea, this is amazing work! After doing fifteen of these things, though- yep, time to automate! Just a carousel would be an immense help, where the computer turns the loom to each successive attachment point.

    1. Polar coordinates! If the computer turned the loom (always in the same direction) so that the next attachment point was at the top, then a simple mechanism (with a tensioner) could loop the thread over that point. Much easier than any sort of XY plotter arrangement.

    2. Maybe one of them ring of LEDs, like the clock from the other day, to tell him which pin to connect to which. Lay the portrait in the middle of the ring each time.

  2. Cool idea. I like the view of it.
    The appearance of a portrait within the obvious constraints of a piece of string is quite captivating.
    Making these things on recipie from a computer just seems a waste of human resource though.
    Reminds me of the girls who were wiring ferrite (rom/ram) by hand for the first space shuttles.

    My guess is he’s able to sell one of these art pieces for more than a CNC to make these things cost.
    On second guess, he’s probably only able to sell these to people who don’t know what CNC is.

    I wonder if he has taken the thickness of the pins into account and wrapping the wire (c)cw for higher resolution.

  3. So it’s just string, going from X pin to Y? That’s amazing! Seems like a brand new, original idea too. Clever bloke.

    I don’t think it’s properly called “knit” though.

  4. “Where few black strings overlap, it’s light, and where more overlap, it’s darker.”
    Literally where they overlap it’s lighter but where they are close together not overlapping it’s darker. You get sort of ‘caustic’ effects. My grandmother had an abstract piece, probably 50 years old at least, that included gentle curves that were very strongly defined. I think there is a better way to work this math.

    1. Yes, it’s quite similar. Doing this with thread is pretty awesome; I really like the results.

      I was thinking of CT back in 2013 and came up with the idea of a laser display based on the same principles. I ended up writing a simulator but never found the time to make a prototype. I just now threw what I had on hackaday.io – I think you could pretty easily make a real-time display this way.

      https://hackaday.io/project/12889-mid-air-laser-display

  5. That is truly inspired work, a great demonstration of art and mathematics, perfect for motivating students who are having trouble “getting” the beauty inherent in mathematics.

  6. I wanna do a negative….. black paper backing….. instead of hooks…. multicolor 3mm LEDs, obviously angled a bit…. then lace it with fishing line or similar monofilament….. use ArduPiThing to cycle colors of LEDs….

    …. do one each of Elvis, Marilyn Monroe and Kramer from Seinfeld and get them in the malls for Christmas.

    1. I gave it a quick try calculating the string’s scores by accumulating the pixel values. The simulated result is not close to what he achieved. Seems there is quite some clever tuning required. If you’re still interested, I can publish my code (C++ and OpenCV).

      1. It is more closely related than you think, if you actually understand what you are looking at. With the string there are extra constraints but the process of discovering the correct geometry sequence is the dame idea. Unfortunately the source code for JNetic does not seem to be on that site so modifying it to add the required constraints is not possible therefore you would need to start from scratch and write a tool to do it for you.

      1. Process, simplified:
        1. create a small reference image (for example 200×200 pix, a bigger one will not produce better results)
        2. create a stack of all possible lines between the pins (in my example I don’t want lines between pins that are less than 30 pins apart)
        3. pick a random starting point
        4. try all line options from this point according to the stack, calculate which option has the lowest total pixel error compared to the reference image
        5. draw the line, and remove from stack (both ways, because I don’t want the same line used twice)
        6. repeat 3000 – 5000 times

    1. For the images above I implemented a couple of subalgorithms, for example to guarantee even line distribution, additional focus maps for accurate representation of crucial details, etc.

      I think the optimal number of pins is dictated mostly by the desired resolution and the line width.
      These 2 factors together determine the maximum achievable black coverage.

      A “perfect” picture is impossible because lines have to cross lighter area’s to cover darker area’s.
      Obviously, images with darker colors at the edges are more suitable, but you could also use white lines on a dark canvas to create a picture with a light background:

      1. Very interesting…

        I also noticed that when I run your animated Tyrion Lannister link multiple times and compare the resulting images, each “knit” varies slightly.

        Is this a variation that you purposely built into the algorithm?

        I am a complete new to programming but am very interested in where to begin learning how to do this.

        1. The variation is not in the algorithm, but in the function that displays the results.

          The algorithm is not included, but the pin sequence is in the config.lineSequence array in the display.js source:
          http://www.inforaction.nl/knit/display.js
          Each pin has a number assigned to it: 0 – 199.
          0 is the pin at the right (at 3 o’clock), the pin numbers count up around the clock.

          I wanted to simulate thread in real life, which will not be perfectly straight between the pins.
          Overlapping identical patterns (in this case the lines from each pin to the other pins) tend to produce secundary patterns (moiré).
          These secundary patterns are cancelled out by random variation of the line curves.
          So most lines are not perfectly straight, but have an almost imperceptible quadratic curve of which the maximum center offset can be set by the linevariation variable in the url.

          If you set linevariation=0, the result will be exacly the same each time, but you will see moiré patterns:
          http://www.inforaction.nl/knit/?linedelay=0&linesmax=4000&linewidth=.25&linevariation=0

          You can contact me at michel_nospam@inforaction.nl if you want help to get started.

          1. Simply ingenious…I wonder if moire patterns are as apparent on a physical knit, or whether it’s mostly a consequence of the limited resolution of digital renderings.

            I imagine threading with some degree of slack (or anything less than fully taut) will be problematic, as slack from successive threads would inevitably accumulate until at least one loop falls off its pin.

          2. @Harry: I don’t know, I guess we just have to try :)
            I think it would help if the pins are slightly pulled back, to prevent the thread from falling off.
            Maybe thread with some elasticity works better than very rigid thread, but you also have to take into consideration how the properties of the thread will change over a longer period of time.
            I’m planning to build a frame and do some knitting after my holiday break.
            I will post the results here for anyone who’s interested.

            2 extra examples:

  7. Inspired by all this stuff and impressed by the art, for the past month I have made my own version of software in java, it was also a learning experience not being a programmer I even learned multithreaded programming to speed up the cals required. I have also made an android app to assist the knitting process. Contrary to all I have seen on hackaday and various sources it seems I am the first to actually knit the output of my software. Find attached the resulting knit, 300 pins and 3100 stings to create. My daughter helped me with the knitting!

      1. This is awesome! Is the app available to download? I have zero programming knowledge but I’d love to be able to make one of these. Everyone’s been playing with portraits but I’d love to see the results of landscape photos, or maybe just putting geometric patterns with different colour layers… UV reactive layers.. they’d make great party decor!

  8. An update:
    Last week I finally had time to build something.
    My girlfriend is a huge Marley fan, so I made her a knit for her birthday.
    She was over the moon with it :)

    Preparation:
    For the loom I used a 80 cm laminated wooden hoop with tiny screw hooks (20 x 12 mm).
    Using a large paper template with radians, the 200 pin locations were marked at the inside of the hoop.
    The hooks were screwed in after predrilling 1.6 mm holes with a dremel.
    Because there’s a lot of tension involved, reinforcement is needed for the woorden hoop.
    So I made a back board out of 12 mm MDF with the same diameter as the hoop.
    After painting it white, I screwed the hoop on top of it.

    Wiring:
    I used black cotton polyester core thread on a 7500 m king spool (75 Nm ~ 0.21 mm diameter)
    This kind of thin elastic thread is normally used for sails and tents, and is UV light protected.
    To visualize the instructions I made an app, which also calculates the cross wire direction around the pins for consistency.
    I plugged in Google translate for spoken word instructions to speed up the process :)

    Results:
    The final piece turned out pretty well.
    Nice picture details, and the depth effect of the stacked threads is awesome!
    The thread turned out to be a fraction thicker than anticipated by the specifications, so maybe next time I’ll use even thinner thread.
    In total I manually processed 3844 lines.
    The piece contains about 2.3 km of continuous thread :)

    A small video about the depth effect:
    [video src="http://www.inforaction.nl/knit/results/result.mp4" /]

    1. Oh Michel! What a beautiful job and present! Really, the result is spectacular and the loom amplify its beauty. Congrats and thanks for the pictures!
      Like Phil, you made an android (?) app, but link with translator is good idea to work easier. You calculated partern with Christian’s processing? Can you please, share with community your programme/app? :)

    2. That is incredible, Michel. I can’t imagine how many hours that took!

      I am looking to make one of these myself. But before I spend days “knitting” I want to ensure the best results by optimizing the pattern processing.

      I believe your program produces the most detailed results. You previously spoke of implementing sub-algorithms for even line distribution and focus maps for accurate representation of details. Would you care to elaborate on this?

      Also, do you recommend any form of image processing that can be done in Photoshop prior to feeding it into a program?

    3. Thanks for your compliments :)

      @Alex:
      I implemented my own image/pattern processing as a html5 app.
      I don’t have any plans to publish the code anytime soon, but maybe sometime..

      @Harry:
      It took about 4 hours to build the loom, and 8 hours to do the “knitting”.
      Areas with important details should have more priority in the error calculation.
      I use an additional grey scale image map to accomplish this. (in photoshop)
      It really depends on the contents if pre processing of the reference image is needed.
      The outer regions of the reference image ideally should have a dark color of at least 50% black, because this area needs to be crossed over a lot to create the darker areas of the image.
      I usually optimize the contrast of important areas like the pupils/white in the eyes, mouth/teeth, etc before processing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s