Slashdot Mirror


Webcam Jigsaw Solver in 200 Lines of Python

leighklotz writes "Jeff Breidenbach and 200 lines of Python code have brought us the Glyphsaw Puzzle solver. Hold a puzzle piece up to a webcam, and the display sgiws exactly where in the puzzle the piece belongs. The solver uses the Python Imaging Library (PIL), Numerical Python, and the PARC DataGlyph Toolkit. By the way, you can make your own DataGlyphs."

47 of 199 comments (clear)

  1. First by Anonymous Coward · · Score: 5, Funny

    Oh, but I bet it uses a bunch of libraries post.

  2. sgiws? by MaineCoon · · Score: 5, Funny
    and the display sgiws exactly where in
    English, please?
    --
    Hunt your preferred prey at Aliens vs Predator MUD. Join the war at avpmud.com port 4000
    1. Re:sgiws? by JPickard · · Score: 5, Funny

      What's wrong with sgiws? it's a perfectly cromulent word.

    2. Re:sgiws? by ackthpt · · Score: 3, Funny
      and the display sgiws exactly where in

      English, please?

      It's a welsh word, you insensitive clod!

      --

      A feeling of having made the same mistake before: Deja Foobar
    3. Re:sgiws? by gambit3 · · Score: 4, Funny

      See, if you had the jigsaw solver, it would solve this puzzle for you!

      r;r,rmystu. ,u frst Esydpm///

    4. Re:sgiws? by CitznFish · · Score: 3, Funny

      Maybe you needed to pay more attention in Engrish class?

      --
      'mmmmmmmmm.... forbidden donut'
    5. Re:sgiws? by Spunk · · Score: 2, Funny

      Holy shit, it solves Welsh?

  3. Other applications? by RM6f9 · · Score: 3, Interesting

    Facial recognition? Or, was this a by-product of same?

    --
    Take the 90-Day Challenge! http://rwmurker.bodybyvi.com/
  4. Needs DataGlyphs by commonchaos · · Score: 5, Informative
    This code will only work if the puzzle pieces are printed using DataGlyphs


    A Glyphsaw Puzzle starts out as a computer graphics file generated by the PARC DataGlyph Toolkit. The image is sent to a professional jigsaw puzzle manufacturing company, which creates cardboard puzzle pieces. From a distance, the pieces look similar to those from any other jigsaw puzzle. Up close, one can see individual glyphmarks.
    1. Re:Needs DataGlyphs by oliverthered · · Score: 3, Informative

      It's an advert for DataGlyphs, showing how:

      "PARC DataGlyphs are a robust and unobtrusive method of embedding computer-readable data on surfaces such as paper, labels, plastic, glass, or metal.

      Basic DataGlyphs are a pattern of forward and backward slashes representing ones and zeroes. This pattern forms an evenly textured field.

      Unlike most barcodes, DataGlyphs are flexible in shape and size. Their structure and robust error correction also make them suitable for curved surfaces and other situations where barcodes fail.
      "

      --
      thank God the internet isn't a human right.
  5. Somone should sgiw them by amling · · Score: 5, Funny

    exactly where the 'h' and 'o' keys are.

    --
    70e808a22cb027cde4a6abddf6435d55
  6. Wrong section? by NemesisStar · · Score: 5, Insightful

    Shouldn't this news be under programming instead of software? The image for programming is a jigsaw getting solved!

  7. Since it can use anything it wants by Neil+Blender · · Score: 3, Funny

    Here's a one line puzzle solver

    [user@localhost] perl -e '`python glyphsaw`'

    1. Re:Since it can use anything it wants by Sweetshark · · Score: 2, Funny
      [user@localhost] perl -e '`python glyphsaw`'
      Bah! That must be a fake! Real Perl should be unspeakable and unreadable!
  8. More importantly... by gabecubbage · · Score: 2, Funny

    Yes, very nice.

    But the important question is, can it assemble the puzzle faster than Gary Kasparov?

    1. Re:More importantly... by Anonymous Coward · · Score: 3, Funny

      > can it assemble the puzzle faster than Gary Kasparov?
      No, Gary Kasparov takes a much longer time to assemble.

  9. Google knows all by jesser · · Score: 5, Funny

    Google Search: sgiws

    Did you mean: shows

    --
    The shareholder is always right.
    1. Re:Google knows all by EverStoned · · Score: 2, Informative

      Look at your keyboard, it makes sense.

    2. Re:Google knows all by jc42 · · Score: 2, Interesting

      No, it's not really scary. They just programmed knowledge of one of the most common typing errors: hitting a key adjacent to the one intended. Lots of spelling checkers do this. It merely shows that the google folks looked at the problem reasonably, used known techniques for guessing what was meant, and did a good job of programming it.

      --
      Those who do study history are doomed to stand helplessly by while everyone else repeats it.
  10. 200 lines? by PoopJuggler · · Score: 5, Insightful

    Big deal. I can write the same thing in C in a single line of code. Oh but you have to link in 100,000,000 lines of libraries and include files, but that doesn't seem to count...

    1. Re:200 lines? by thedustbustr · · Score: 4, Insightful

      > What is a reliable means of counting LOC then?

      Count every line of code written specifically for this project. Publically availabe libraries don't count; internal libraries written by the author (for use in this project or generalized internal code from a previous project does. This accurately reflects the complexity of the app from the coder's perspective.

      --
      This sig is false.
  11. slow already by Zenophran · · Score: 3, Informative
  12. Jiglyph by Doc+Ruby · · Score: 4, Interesting

    A "jigsaw" is a nifty tool that dances around a pattern in a sheet of wood, a narrow saw band that cuts like a laser along curves (OK, compared to its 19th Century prececesors). A "jigsaw puzzle" is a puzzle made by jigsawing a picture, and putting it back together along its deceptively simple interlocking contours. This device substitutes an AI scanner for the saw, in inverse operation to the jigsaw. So, if anything, it's a "Jiglyph", not a "Glyphsaw" - unless they mean that it "saw" the "glyph".

    --

    --
    make install -not war

    1. Re:Jiglyph by PedanticSpellingTrol · · Score: 3, Funny

      In soviet russia, Pedantic defines me!

  13. External libraries by R.Mo_Robert · · Score: 3, Insightful

    200 lines of Python? At least this time they mentioned the additional external libraries, unlike with that "15-line" P2P program a while back...

    :)
    --
    R.Mo
    1. Re:External libraries by lcracker · · Score: 3, Informative

      The "15-line" P2P program didn't use any libraries that don't ship with the Python interpreter. This uses several 3rd party packages.

  14. like the tetris-playing bot by bodrell · · Score: 4, Insightful
    Anyone remember that? It was pretty cool--the guy wrote a scoring algorithm and brute-forced all possible positions for whatever piece was about to fall.

    Oh, and I also think it's pretty stupid to talk about how few lines it took to write the program when it's using a bunch of libraries. I could just write a one-liner that calls this program, by that rationale.

    Here's the Artificial Intelligence Tetris I was mentioning.

    --
    Si la vida me da palo, yo la voy a soportar Si la vida me da palo, yo la voy a espabilar
  15. Puzzle by Anonymous Coward · · Score: 5, Insightful

    This glyph thing is all very nice and all, but it CHEATS. The puzzle is specially printed and each piece has a unique address. Where's the challenge in that?

    NOW if they could do this with an off the Walmart shelf puzzle, THAT would be something.

    1. Re:Puzzle by m50d · · Score: 2, Informative

      The challenge is being able to be read the adress by using an ordinary webcam, with no need to carefully line up the piece. No, it's not as good as solving an arbitrary puzzle, but it's still pretty good.

      --
      I am trolling
  16. Re:Anti-spam image checks? by James_G · · Score: 3, Interesting
    Wow 200 lines? I bet it has tons of includes though

    "The Glyphsaw Puzzle solver is implemented in less than 200 lines of Python code by making good use of the PARC DataGlyph Toolkit, the Python Imaging Library (PIL), and Numerical Python."

    ^ I bet you'd win that bet.

  17. Not really, sadly. by Yobgod+Ababua · · Score: 4, Informative

    The technology is that they can embed arbitrary digital information into arbitrary images, and do it in such a way that it's resistant to errors, damage, blurriness and other rigors of the real world.

    If you have a jigsaw made using this technology where the embedded data indicates the location within the original image, you can use this software to decode that data and display where the piece should go. It doesn't look at the actual image at all, and thus wouldn't help you solve any 'normal' jigsaws, or do any sort of general image recognition.

    It does use some similar techniques to facial recognition to identify the intersection points and enable the glyph decoding, but that's all.

  18. Wow !!! by kabz · · Score: 2, Funny

    Finally ... something on Slashdot to interest my grandmother !!

    --
    -- "It's not stalking if you're married!" My Wife.
  19. A REAL puzzle by sburnett · · Score: 3, Funny

    If you hold a piece of their Slashdotted Web server up to the camera, will this program be able to reassemble it?

  20. It's not image recognition by Yobgod+Ababua · · Score: 2, Insightful

    It reads digital information encoded into the image... it doesn't look at the actual image itself. It's still quite cool, but no good for what you are thinking.

    I already explained more about this to a comment Here

  21. Coral link to this by Announcer · · Score: 2, Informative

    For when the server melts down, here it is...

    http://www2.parc.com.nyud.net:8090/istl/members/jb reiden/glyphsaw/

    Interesting article, but it's using a special digitally encoded pattern to "help" the software identify the pieces. You can't just input the picture from a puzzle box, then start showing it pieces, and have it solve them for you.

    --
    Willie...
  22. Didn't they just... by Chuckstar · · Score: 2, Informative

    ...overlay a two-dimensional bar code over the image?

    Tell me if I'm mistaken, but didn't the summary imply that it was identifying the puzzle piece by the picture on it? Now that would be cool.

    So much for using this to make a face-scanner, unless we tattoo bar codes on everyone's faces.

    I guess this is an interesting academic exercise, but I don't see how they've really done anything new.

  23. This isn't as clever as you think by Anonymous Coward · · Score: 5, Insightful

    Neat, but not amazing. You have to read the article to realize that the system only works if all the puzzle pieces have been printed with special marks, DataGlyphs. It's like printing registration marks on all the pieces. Sort of. The dataglyphs actually have more interesting properties, but the point is that this isn't the vision system you expect. It isn't even a general puspose puzzle solving system. As soon as the system recognizes the glyph marks it knows exactly where the piece belongs. It doesn't "solve" anything. It doesn't have to figure out where the pieces go. You couldn't show it pieces from a puzzle off the shelf and have it solve it.

  24. Lame! by CyberVenom · · Score: 5, Insightful

    Somebody please amend the OP. When the site finishes melting down no one will have a clue what this is about:

    Essentially it is just a bunch of puzzle pieces with 2-D barcodes printed on them, and a computer+webcam+python used as a barcode reader.

    (oh, and as a bonus, the 2-D barcodes are somewhat colored so that it looks like a picture from a distance.)

    It is no more a "Jigsaw Puzzle Solver" than a locomotive's wheels are an autopilot decive. They each achieve the end goal only when the rails have been laid in advance.

    -CV

  25. Oh yeah, GlyphMarks by Anonymous Coward · · Score: 4, Insightful

    I liked them better when they were called "two-dimensional bar codes".

    This /. post is a little misleading by the way... the webcam and software doesn't "solve" the jigsaw puzzle, it just reads the coordinates which are encoded on each piece.

    You wanna repeat this experiment at home? Buy a small jigsaw puzzle. Solve it. Label each piece with it's (x,y) coordinate in the solved puzzle. For instance, top-left could be (1,1), the one to its immediate right could be (2,1), and so on.

    Then take the puzzle apart and AMAZE your friends when you can deduce the position of each piece simply by HOLDING IT UP TO YOUR EYES!

  26. This uses Reed-Solomon coding for error correction by hqm · · Score: 2, Interesting
    I made a C library of the Reed-Solomon error correction routines and published it as the rscode library on Sourceforge at http://rscode.sourceforge.net/

    I wrote a version of this library originally as a contractor for PARC when I was in grad school, to use as the error correction coding for their data glyphs. This is bsaically the same algorithm used for audio and CD-ROM data.

  27. This defeats the entire purpose of doing jigsaws. by i41Overlord · · Score: 2, Insightful

    If you wanted the picture put together for you, you'd buy a poster, not a jigsaw puzzle.

    When the entire purpose of buying a puzzle is to make you do some mental work, then having that work done automatically is self-defeating.

  28. Re:its by gfody · · Score: 2, Insightful

    this isn't a jigsaw solver. the puzzle needs to be created with the glyph marks already. its like each peice has an embedded watermark telling the program where it goes.

    at first glance I thought it was a program that could solve jigsaw puzzles by analyzing each piece, its shape, the image on it and figure out where it goes in realtime. that would be really interesting as it would probably have to employ some crazy neural net algo to avoid exponential time.

    --

    bite my glorious golden ass.
  29. Re:This defeats the entire purpose of doing jigsaw by psyconaut · · Score: 2, Insightful

    You're 100% missing the point. It's not about doing the jigsaw, but using glyphs to identify realworld objects and placing those in perspective.

    -psy

  30. so what? by Anonymous Coward · · Score: 2, Insightful

    I was prepared to be impressed but then I read that each piece is basically pre-encoded so it's only a matter of reading the coding. Much less impressive than actually using the image on the piece to determine its proper position.

  31. You mean like this? by jab · · Score: 3, Informative

    PARC (and others) have already tackled that problem. Here's my favorite research paper on the topic.

    Goldberg, D.; Malon, C.; Bern, M. W. A global approach to automatic solution of jigsaw puzzles. Computational Geometry. 2004 June; 28 (2): 165-174.

  32. closed source, proprietary, and astroturf by SuperBanana · · Score: 4, Interesting

    Yep, and it's not only closed source, it's proprietary; to develop for it, you need to buy the eval kit and license the technology.

    Furthermore, not a single slashdot reader seems to have noticed that the article is one giant piece of astroturf. The submitter's website plainly lists his address in Palo Alto, which just happens to be the site of PARC, the Xerox research center that developed the technology. Coincidence? I seriously doubt it.

    Oh, and this technology is mostly used in color copiers for printing out the machine's serial number in pure yellow so you can't see it..but the document can be traced back to you (this is supposedly for the Secret Service to chase down people making color copies of US currency and whatnot, but that's a bullshit excuse now that these copiers all have currency detectors and refuse to copy currency). They don't point it out specifically, but there are various hints dropped in the FAQ about it.

    1. Re:closed source, proprietary, and astroturf by leighklotz · · Score: 2, Informative

      >The article is one giant piece of astroturf. The submitter's website
      >plainly lists his address in Palo Alto, which just happens to be
      >the site of PARC, the Xerox research center that developed the
      >technology. Coincidence? I seriously doubt it.

      Except I don't work for PARC. I do work for Xerox, and Xerox is the sole stockholder in PARC, though PARC is a separate company with its own business deals. I happen to have the privilege of wandering around and finding neat stuff (under non-disclosure), and when it becomes public I can tell other people about it. Jeff mentioned to me in the PARC cafeteria that he'd done this thing, so I posted it, becacuse I thought slashdot readers would be interested.