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."

199 comments

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

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

    1. Re:First by stupidfoo · · Score: 1, Funny

      The code:


      from puzzlesolver.puzzlepiece import puzzlepiece
      from puzzlesolver.placepiece import placepiece


      Yes, my python skills are quite good.

    2. Re:First by Fahrenheit+450 · · Score: 1

      JCL says, "Talk to the hand!"

      --
      -30-
    3. Re:First by CastrTroy · · Score: 1

      Yeah. I wrote a 1 line office suite in Bash. It looks something like this.

      /usr/bin/soffice

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    4. Re:First by suwain_2 · · Score: 1

      Thanks for sgiwing us the evidence.

      --
      ________________________________________________
      suwain_2 :: quality slashdot p
    5. Re:First by Anonymous Coward · · Score: 0

      Youra moran. Languages dont live. They dont evin have sex.

    6. Re:First by CastrTroy · · Score: 0, Offtopic

      I'm sure you know wikipedia is the one and only source for scientific knowledge. I got my definition right out of the glossary of, A Brief History Of Time.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    7. Re:First by yerfatma · · Score: 0, Flamebait

      No life? No sex? Do they have a low user # here?

  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 Anonymous Coward · · Score: 0

      I believe sgiws is "shows" with a rightwards 1 key transpose error on "ho" only -- very strange behaviour.

      Ytu s foggrtrmy lrunpstf@

    4. 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///

    5. Re:sgiws? by yossarian+dent · · Score: 1

      In Soviet Russia, proper spelling bastardizes you!

      --
      sig not ready: (A)bort, (R)etry, (F)ail.
    6. Re:sgiws? by Shut+the+fuck+up! · · Score: 0, Informative

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

      elementary, my dear Watson...

    7. Re:sgiws? by hunterx11 · · Score: 1
      --
      English is easier said than done.
    8. Re:sgiws? by ari_j · · Score: 1

      Fycj tiym tiy fycjubg cybt!

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

      Maybe you needed to pay more attention in Engrish class?

      --
      'mmmmmmmmm.... forbidden donut'
    10. Re:sgiws? by gardyloo · · Score: 1

      It's a perfectly good flutzpah.

    11. Re:sgiws? by SmartSsa · · Score: 1

      It's not strange, it's one hand shifted. It is strange how the submitter, and the editor didn't catch it.

      I for one can't even force myself to type with one hand shifted. My fat fingers collide when they encounter shared keys :(

    12. Re:sgiws? by Anonymous Coward · · Score: 0
      Fycj tiym tiy fycjubg cybt!

      Translation from Welsh: Never ask for directions in Wales. You'll be washing spit out of your hair for a fortnight.

    13. Re:sgiws? by stuntpope · · Score: 1

      He's mixed up with that other reptile-themed programming language, Jabberwocky.

      (Please, no Spanish Inquisitions over my seeming ignorance of the etymology of Python.)

    14. Re:sgiws? by Cryptnotic · · Score: 1

      Did you notice how "g" is just to the left of "h" and "i" is just to the left of "o" on an English-language keyboard?

      (His left hand was in the right place, but the right hand was shifted left by one key).

      --
      My other first post is car post.
    15. Re:sgiws? by jericho4.0 · · Score: 1
      If by 'strange' you mean 'normal editor lapses'.

      --
      "A language that doesn't affect the way you think about programming, is not worth knowing" - Alan Perlis
    16. Re:sgiws? by niteice · · Score: 1

      Hmm? I don't think SB said anything even resembling "sgiws" (no matter how awesome the song and video are).

      --
      ROMANES EUNT DOMUS
    17. Re:sgiws? by Fahrenheit+450 · · Score: 1

      That's funny... I've got an "a" to the left my "o", and a "d" to the left of my "h".

      I guess I'm not typing in English...

      --
      -30-
    18. Re:sgiws? by Anonymous Coward · · Score: 0

      The strange thing is, if the submitter's right hand truly was shifted, how did he type the rest of the article just fine? The editor fixed a submitted typo with HIS right hand shifted?

    19. Re:sgiws? by Anonymous Coward · · Score: 0

      Clearly he's referring to the display being an SGI workstation.

    20. Re:sgiws? by Profane+MuthaFucka · · Score: 1

      Damn. Jeffy told me he wasn't going to show those to anyone.

      --
      Fascism trolls keeping me up every night. When I starts a preachin', he HITS ME WITH HIS REICH!
    21. Re:sgiws? by Cryptnotic · · Score: 1

      Not a standard English keyboard then. It's probably Dvorak, but you probably know that already and were being a smartass.

      --
      My other first post is car post.
    22. Re:sgiws? by Reignking · · Score: 1, Funny

      Me fail English? That's unpossible!

      --
      One man's Funny is another man's Offtopic.
    23. Re:sgiws? by mikeage · · Score: 1

      What's wrong with sgiws? it's a perfectly cromulent word.
      Are you trying to embiggen our language?

      --
      -- Is "Sig" copyrighted by www.sig.com?
    24. Re:sgiws? by hunterx11 · · Score: 1

      No, but it's about intelligible as fhqwhgads.

      --
      English is easier said than done.
    25. Re:sgiws? by InfiniteWisdom · · Score: 0, Flamebait

      Shut the fuck up!

    26. Re:sgiws? by Anonymous Coward · · Score: 0

      The editor types with one index finger. The other one is in his nose.

    27. Re:sgiws? by tcr · · Score: 1

      Plagiarist!

      --


      Information wants to be beer.
    28. Re:sgiws? by AstroSurf · · Score: 1

      word is supposed to be "shows". Poster had his right hand placed one key to the left of where it should have been.

      But as another has posted below, it's a perfectly cromulent word. :)

      --
      Astro
    29. Re:sgiws? by Spunk · · Score: 2, Funny

      Holy shit, it solves Welsh?

    30. Re:sgiws? by pdbaby · · Score: 1

      No spanish inquisitions? But... how could you have known? Nobody expects the spanish inquisition. Their main weapon is ...

      --
      Global symbol "$deity" requires explicit package name at line 2. - If only $scripture started "use strict;"
    31. Re:sgiws? by Maow · · Score: 0
      and the display sgiws exactly where in

      English, please?

      Skews - he said "skews".

      While chewing a donut. Old fashioned. Plain.

      Doesn't anyone speak somnambulant anymore?

    32. Re:sgiws? by KlomDark · · Score: 1

      Yay, the beginning of a new famous net word like TEH. :)

    33. Re:sgiws? by Anonymous Coward · · Score: 0

      This is Slashdot, I don't feel the need to attribute a Blackadder quote any more than people would need to attribute a Monty Python quote.

    34. Re:sgiws? by millennial · · Score: 1

      Not flamebait, folks... merely quoting the parent's username...

      --
      I am scientifically inaccurate.
    35. Re:sgiws? by HTH+NE1 · · Score: 1

      So it's a "gune riw" error then.

      --
      Oh, say does that Star-Spangled Banner entwine / The myrtle of Venus with Bacchus's vine?
    36. Re:sgiws? by Principal+Skinner · · Score: 1

      Getm watcg tiyr fycjubg niytg/1

      --
      one hundred twenty
      is just enough characters
      to write a haiku
  3. its by mr_tommy · · Score: 1, Insightful

    It's amazing how beautiful code can be - it's simple, to the point, and functional. Bravo - a good lesson here for anyone who's thought about doing anything at code level.

    1. Re:its by nacturation · · Score: 1

      It's amazing how beautiful code can be ... a good lesson here for anyone who's thought about doing anything at code level.

      Are there other levels on which to achieve beautiful code?

      --
      Want to improve your Karma? Instead of "Post Anonymously", try the "Post Humously" option.
    2. Re:its by Prophetic_Truth · · Score: 1

      Its beautiful, but i feel sorry for the poor soul who beta tested this.

      --
      time is a perception of a being's consciousness
      time is your 6th sense, the wierd ones are 7+
    3. Re:its by mickyflynn · · Score: 1

      print out the source code and throw paint on it Jackson Pollock style?

    4. 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.
    5. Re:its by MattJakel · · Score: 0, Troll

      But it's still misleading to say "only 200 lines of Python" when really all of the module imports add up to thousands of lines. This isn't a downside of course, but such a description makes the program sound simpler than it is.

    6. Re:its by m50d · · Score: 1

      The lesson is to code in Python :)

      --
      I am trolling
  4. 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/
    1. Re:Other applications? by EmbeddedJanitor · · Score: 1

      Reconstruction of Mafia victims.

      --
      Engineering is the art of compromise.
    2. Re:Other applications? by Danimoth · · Score: 1

      Facial recognition? Or, was this a by-product of same? Only if you cut up the face first.

      --
      No smoking sigs indoors.
  5. Research grant by Anonymous Coward · · Score: 0

    However much money these people received in order to research this ...

    I want it doubled. I'm going to research the effects on time consumption of playing online FPS games.

  6. 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 ckemp.org · · Score: 1

      Still, it's built with a surprising degree of intelligence - able to deal with motion and throw away uncertain glyphs.
      That's pretty damn impressive.

    2. 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.
  7. Neat by Anonymous Coward · · Score: 0

    But that's like an automated crossword puzzle solver or maybe god mode. Where's the fun?

  8. Anti-spam image checks? by caryw · · Score: 0

    Wow 200 lines? I bet it has tons of includes though. If image recognition is this good in 200 lines of python how have those anit-spam boxes that make you copy an obscure string to prove you're human not been broken yet. Or maybe they just have?
    - Cary
    --Fairfax Underground: Where Fairfax County comes out to play

    1. 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.

    2. Re:Anti-spam image checks? by Anonymous Coward · · Score: 0

      If you don't like code reuse you are welcome to program in machine code.

    3. Re:Anti-spam image checks? by mikiN · · Score: 1

      #include "everythingbutthekitchensink.h"

      void main(void)
      {
      MakeItSo();
      }

      That's it, 6 lines. Everyone can write short programs, if all you do is include some doitall libraries...

      --
      The Hacker's Guide To The Kernel: Don't panic()!
    4. Re:Anti-spam image checks? by Anonymous Coward · · Score: 0

      If you don't like code reuse...

    5. Re:Anti-spam image checks? by jay-be-em · · Score: 1

      Wow, now /. users not only fail to read the article, but don't even read the complete summary.

      --
      "Orthodoxy means not thinking--not needing to think. Orthodoxy is unconsciousness." --Eric Blair
  9. Somone should sgiw them by amling · · Score: 5, Funny

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

    --
    70e808a22cb027cde4a6abddf6435d55
  10. 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!

    1. Re:Wrong section? by Anonymous Coward · · Score: 0

      But the real question is, "How many lines of python can this be fixed in"I bet this can be fixed in about 150 lines of python

    2. Re:Wrong section? by Anonymous Coward · · Score: 1, Funny

      They'll get it right when they repost it tomorrow. See, dupes DO have a purpose!

  11. 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 BobNET · · Score: 1

      Not bad, in only 28 characters (including the newline at the end). But try this:

      sh -c python glyphsaw
      Only 22 characters this time, and it could probably be even shorter if you prepare symbolic links ahead of time.
    2. 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!
    3. Re:Since it can use anything it wants by Anonymous Coward · · Score: 0

      perl -e 'print join "", map{ $_ = chr($_^ord("a")) } split / /, "69 62 65 92 65 70 1 14 17 16 19 23 22 2 14 17 8 13 16 19 18 6 23 22 20 27 9 3 23 22 0 64 21 14 17 24 23 22 13 25 22 2 5 20 4 7 9 15 10 11 14 17 1 70 90 65 21 19 65 78 15 76 27 0 76 12 64 78 0 76 12 15 76 27 65 78 90 65 18 78 58 63 0 6 9 13 15 14 17 18 21 22 24 61 1 65 60 78 78 6 90 65 4 23 0 13 90 108 107"'

      ( I think that'll work... )

    4. Re:Since it can use anything it wants by Anonymous Coward · · Score: 0

      How about two words... "Do it!"

      See? A puzzle solver without any line of code.

    5. Re:Since it can use anything it wants by Anonymous Coward · · Score: 0

      s/print/eval/

      =/

    6. Re:Since it can use anything it wants by RevAaron · · Score: 1

      Since it can use anything it wants...

      I don't know about you, but when I code, I *never* use any useful libraries. Programming should never be about getting something done- rather, it should be about reinventing the all the wheels, gears, axels and windshield wipers that I could ever need... In other words, re-writing the OS for each and every app! WOOT! 152 thumbs up!

      --

      Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
  12. 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.

    2. Re:More importantly... by Anonymous Coward · · Score: 0

      Uh, I think you mean "Yes".

  13. 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 XFilesFMDS1013 · · Score: 1

      Hey, if google can correct it, it's fine by me.

    2. Re:Google knows all by EverStoned · · Score: 2, Informative

      Look at your keyboard, it makes sense.

    3. Re:Google knows all by Feanturi · · Score: 1

      Okay, that's just freakin' scary.

    4. Re:Google knows all by noidentity · · Score: 1

      I guess the article submitter speaks this other language and slipped the term in. Your google search reveals lots of web pages in this new language, but sadly doesn't offer to translate them. Oh well.

    5. Re:Google knows all by vistic · · Score: 1

      looks like irish or welsh or something to me...

    6. Re:Google knows all by SpotBug · · Score: 1


      Google frickin' rocks! (still)

      Had to be said.

      --
      cygnuhchur
    7. 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.
    8. Re:Google knows all by qray · · Score: 1

      I once took a typing test and didn't realize my hands were shifted on key to the left the entire test until after the test. Hey, they said don't look at the keyboard. I tried to convince the teacher to mentally shift all the letters to the right and grade after the adjustment. She wasn't willing and I flunked the test :-(

      --
      tegro pagron mockrod drondor

    9. Re:Google knows all by leighklotz · · Score: 1

      > Look at your keyboard, it makes sense.
      Yes, I typed it on my hiptop.
      Full disclosure: Danger is located in Palo Alto. I don't work for them. They're near Fry's though and I do sometimes go to Fry's.

    10. Re:Google knows all by drewness · · Score: 1

      Google has interesting suggestions sometimes.

    11. Re:Google knows all by OAB_X · · Score: 1

      And all this time I thought Google was god cause it could tell what I really meant

  14. 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 Anonymous Coward · · Score: 0

      Do you happen to work at Microsoft?

    2. Re:200 lines? by RevAaron · · Score: 1

      I thought this too, especially after looking at the page, seeing the libraries and components it uses to do this. 200 lines seems almost too much, but I suppose it's python, which can be a bit verbose, though nothing like languages outside of it's language class- c, c++, java, and others would prolly be more... But about all those 200 lines of python are doing:

      1. initialize DataGlyph, webcam.
      2. Get Webcam image. Hand off image of puzzle piece to DataGlyph library.
      3. DataGlyph library returns code. DataGlyph is just a visual means of encoding data, sort of the successor to the barcode. DataGlyph returns "2x4".
      4. Take the puzzle piece image, resize it to fit the proportions of your display canvas, and pop it into the second column, fourth row.

      Yeah, 200 lines, a system that relies on oodles of other libraries. But still, that's a helluva slippery slope if you're going to question that. What is a reliable means of counting LOC then? Even the simplest C program- let's say printf("Hello World!\n"); - relies on the various libraries of the OS, and those libraries rely on other stdlib, etc etc... So, is it 2 lines, or a hundred?

      --

      Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
    3. 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.
    4. Re:200 lines? by jab · · Score: 1
      >200 lines seems almost too much [blah, blah, blah]

      While not explicitly mentioned in the writeup, I also programmed the computer to beep when a piece was successfully processed. That added a line right there.

    5. Re:200 lines? by Anonymous Coward · · Score: 0

      You could do the same without any libraries, too, since (unlike Python) a C program doesn't require newlines (unless you want to use preprocessor directives).

    6. Re:200 lines? by fredrikj · · Score: 1

      Python doesn't require newlines.

      exec "if foo:\n print bar()\nelse: print baz()"

      etc

    7. Re:200 lines? by jc42 · · Score: 1

      Yeah, and what I immediately thought was: Why didn't they do it in 2 lines? They already included a number of huge libraries. Just put the program's code into a library, include the library, and call it's main routine.

      Anything can be done in 2 lines, if you don't count the code in libraries.

      --
      Those who do study history are doomed to stand helplessly by while everyone else repeats it.
    8. Re:200 lines? by Anonymous Coward · · Score: 0

      The oracle is having mental seizures!

      Please tell jeff@jab.org right away.

    9. Re:200 lines? by p3d0 · · Score: 1
      Bullshit. Let's see your code.

      You seem to have missed the whole point of this accomplishment.

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
  15. slow already by Zenophran · · Score: 3, Informative
  16. Hmmm by winstonmeister · · Score: 0, Interesting

    My Mom used to subscribe to some pretty kooky Religious Right publications (unfortunately, she quite possibly still does). I remember one of them was heavily pushing a Net-Nanny type program, and the advertisement claimed it could actually analyze the images and selectively block out sites where the images contained naughty bits but didn't have textual cues for other, competing pieces of software to pick up on. Of course, now that such things might actually be possible, they'll just block all the sites that have pictures of balloons. ;)

    1. Re:Hmmm by stevenvi · · Score: 1

      I know what you're talking about, and it wasn't a hoax, it was for real. While learning about neural networks last semester I remember that being an example of application.

      I don't recall the company's name, but they had image classification that was trained on many pictures to tell if a picture is pornographic or not and eventually some sort of pattern was found. Perhaps images which contain many flesh tones.

    2. Re:Hmmm by mikiN · · Score: 1

      I'm pretty sure that the application would reject the images here, even though they are among the 'safest' you can get...

      --
      The Hacker's Guide To The Kernel: Don't panic()!
  17. 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 Creepy+Crawler · · Score: 1

      Can you define "Pedantic" ?

      --
    2. Re:Jiglyph by PedanticSpellingTrol · · Score: 3, Funny

      In soviet russia, Pedantic defines me!

    3. Re:Jiglyph by Anonymous Coward · · Score: 0

      ha ha
      thats just awesome
      +5 for matching name

  18. 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.

  19. 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
    1. Re:like the tetris-playing bot by Anonymous Coward · · Score: 0

      That's what I tend to do, to make a program short.

      I write all the actual code into functions and then, for example, in C, the actual program just looks like this:

      int main () {
      exist();
      return 0;
      } ... with the 'exist() function doing all the actual work. This way I can say all my programs are four lines long, and it does kind of give a sort of poetic beauty to the code.

    2. Re:like the tetris-playing bot by Boronx · · Score: 1

      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.

      You are so correct, my man. What is the point of a library if you didn't write it yourself? Why, it would be utterly useless!

      I could just write a one-liner that calls this program, by that rationale.

      Well it's not the same, because you'd just be doing what someone has already done, now wouldn't you? This guy did something original, and he did with economy.

    3. Re:like the tetris-playing bot by bodrell · · Score: 1
      You are so correct, my man. What is the point of a library if you didn't write it yourself? Why, it would be utterly useless!

      First, you ought to know that sarcasm does not work well in ASCII.

      Second, who the fuck said libraries weren't useful? Python is great for many reasons (my favorite is that code can look like pseudocode if you don't use lambdas all over the place), and one reason is the great libraries available. I threw together a working curve-fitting program with NumPy, Numarray, and the builtins. It was a learning exercise for me, really, because I do molecular biology by trade--not programming. The vast majority of "my" curve-fitting program was the code from NumPy and Numarray. Can I really take credit for all their work, and call it my own?

      Taking pride in the number of lines of code is pretty stupid, unless there is some way to normalize it. What language are we talking about? Do you count the lines of code in all imported libraries? If not, why not? And some languages are very sparse, with few builtin libraries. Obviously I can write a program with fewer lines in a language that has everything including the kitchen sink built in. I never said this jigsaw program wasn't impressive; I'm just saying I'd be way more impressed if someone did the same thing in 200 lines of assembly.

      --
      Si la vida me da palo, yo la voy a soportar Si la vida me da palo, yo la voy a espabilar
    4. Re:like the tetris-playing bot by Boronx · · Score: 1

      I'm just saying I'd be way more impressed if someone did the same thing in 200 lines of assembly.

      That would be trivial given the right processor and instruction set.

    5. Re:like the tetris-playing bot by jab · · Score: 1
      Can I really take credit for all their work, and call it my own?

      Maybe talking about the small size of the application was meant as a complement to the supporting software libraries, rather than an attempt at "taking credit"

    6. Re:like the tetris-playing bot by bodrell · · Score: 1
      Maybe talking about the small size of the application was meant as a complement to the supporting software libraries, rather than an attempt at "taking credit"
      That would seem to be supported by the note at the bottom:

      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 don't doubt that he did make very good use of the libraries, but that doesn't detract from the point that measuring goodness of code by number of lines is stupid. You could write an indecipherable 15 line Python P2P program. Or you could write a similar program in 100 lines of code, but other people might actually be able to understand it. Or you could write 1000 lines of indecipherable spaghetti code. Number of lines of code is not a good measure of quality. Period.

      BTW, I wasn't saying this particular guy was trying to take credit for other people's work, but there is, in general, a leet attitude in saying "I did this in x lines of code." It sounds like bragging.

      --
      Si la vida me da palo, yo la voy a soportar Si la vida me da palo, yo la voy a espabilar
    7. Re:like the tetris-playing bot by bodrell · · Score: 1
      I'm just saying I'd be way more impressed if someone did the same thing in 200 lines of assembly.

      That would be trivial given the right processor and instruction set.
      And if we could each have our own chip fab, so we could create custom processors at whim, you would have a point.
      --
      Si la vida me da palo, yo la voy a soportar Si la vida me da palo, yo la voy a espabilar
  20. 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 csk_1975 · · Score: 1

      This glyph thing is all very nice and all, but it CHEATS

      Indeed, and why use glyphs at all? As jigsaws are basically grids it'd be far simpler just to print the row,column coordinates on each piece - and it'd take even fewer lines of code to do the recognition, this ain't solving a jigsaw at all.

    2. 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
  21. 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.

    1. Re:Not really, sadly. by thatnerdguy · · Score: 1

      but it begs the question why? Isn't the whole point of doing a puzzle to figure it out yourself?

      --
      I saw the Sign, and it opened up my eyes
    2. Re:Not really, sadly. by Fred_A · · Score: 1

      They are working on facial recognition too.
      If you would just step into your federally approved tattoo parlour please, it will just take a minute...

      --

      May contain traces of nut.
      Made from the freshest electrons.
  22. Wow !!! by kabz · · Score: 2, Funny

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

    --
    -- "It's not stalking if you're married!" My Wife.
  23. 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?

    1. Re:A REAL puzzle by Anonymous Coward · · Score: 0

      No, but it *CAN* redirect you to http://mirrordot.org just fine.

  24. One Line! by Tablizer · · Score: 1

    I wrote one in one line of code! It uses the PuzzleSolver8 library, I must mention :-)

    1. Re:One Line! by Anonymous Coward · · Score: 0

      Another machine code coder?

    2. Re:One Line! by Tablizer · · Score: 1

      no, it would be like:

      print(PuzzleSolver8("puzzle4.dat"));

  25. 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

  26. 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...
  27. Facial barcodes by EmbeddedJanitor · · Score: 1
    Pesky smallprint.

    Could also use this technology for foolproof facial recogtion. Just need to have barcodes stamped on your face!

    --
    Engineering is the art of compromise.
    1. Re:Facial barcodes by Anonymous Coward · · Score: 0

      Could also use this technology for foolproof facial recogtion. Just need to have barcodes stamped on your face!

      That's just so dumb! Only a fool would have his face barcoded!

      Wait, nevermind...

  28. 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.

    1. Re:Didn't they just... by Anonymous Coward · · Score: 0

      Yes, it would have been easier to just write a number on the back of each piece. This is lame.

      Everyone was thinking, "Wow, it just looks at each piece and then actually solves the puzzle!" ... NOT

  29. 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.

    1. Re:This isn't as clever as you think by Anonymous Coward · · Score: 0

      puspose? Somebody needs to sgiw you how to yaw a keyboard.

  30. there's a nub on the j key for a reason... by Anonymous Coward · · Score: 0

    ruggt gabd us ibe soace iver

  31. It's a cheat by Anonymous Coward · · Score: 0, Insightful

    They can only solve puzzles that have been printed with their special dataglyph patterns. So, matching the piece to its location is trivial.

    The real challenge would to do this with a regular jigsaw puzzle, not a specially rigged one.

    The computer vision technology necessary to do this exists today. It's just a matter of putting it together.

    1. Re:It's a cheat by fishbowl · · Score: 1



      "The real challenge would to do this with a regular jigsaw puzzle, not a specially rigged one."

      If it's precise enough it should be able to put the puzzle together by only looking at the back of the pieces, perhaps with intervention whenever two pieces happen to hash to the same shape. Otherwise you should not even need the picture.

      --
      -fb Everything not expressly forbidden is now mandatory.
    2. Re:It's a cheat by jab · · Score: 1
      If it's precise enough it should be able to put the puzzle together by only looking at the back of the pieces, perhaps with intervention whenever two pieces happen to hash to the same shape.

      See A Global Approach to Automatic Solution of Jigsaw Puzzles

  32. sgiws once again by harkabeeparolyn · · Score: 1

    ... that this page was indeed assembled by a herd of dyspeptic zebras or whatever. Are the editors so stupified by their jobs that glaring typos roll right past them now?

  33. 200 lines of code? by Alban · · Score: 1

    Yeah, 200 lines of code using a few libraries compiled from 50000 lines of code.

    1. Re:200 lines of code? by LanceUppercut · · Score: 1

      Exactly. I can do the same thing in C++ using only one line of code, provided a have proper library :)

    2. Re:200 lines of code? by nikkoslack · · Score: 1

      My thoughts exactly - 200 lines of code, plus 50,000 in the math and another 50,000 in the glyph libs, just to read a barcode? ahem.

  34. 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

    1. Re:Lame! by Anonymous Coward · · Score: 0

      "...an autopilot decive."

      I'm afraid your dyslexia sgiws. A sgekkoecjer can help with this, though.

    2. Re:Lame! by Principal+Skinner · · Score: 1

      Did you mean "shellpecker"?

      --
      one hundred twenty
      is just enough characters
      to write a haiku
  35. Please no more Jiglyphs by cgenman · · Score: 1

    ...I can't take any more Bill Cophbies.

  36. 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!

  37. Why?? by AdityaG · · Score: 0

    I thought the whole point of jigsaws was to kill time without your brain sleeping on you. Or just have fun with family. What's next? Have a robot do your fishing while you and your father stay home?

    Pointless in my opinion. And not technologically innovative either like some people have already said.

  38. 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.

  39. 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.

  40. Messagelabs by Dejohn · · Score: 1

    Messagelabs has a product that will detect pornography in images. It works incredibly well. We've been using it to block emailed pornography here for a number of years.

  41. Dataglyphs by Anonymous Coward · · Score: 1, Insightful

    Recall the stories about how printers where marking reproductions of bills- well this is how it's done.
    Fairly neat.

  42. 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

  43. 200 lines is bullshit!!! by Bootle · · Score: 1
    it shows how proficient the programmer is and how well-rounded the libraries are, but it doesn't show how efficient the code is. Not that it matters much nowadays...

    It's certainly no 15 line p2p app!

  44. 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.

    1. Re:so what? by kjamez · · Score: 1

      that's what i'm thinking: match the contours of the piece, save what you can see on the front side, and when you finally get all the pieces in the db, it would automatically scale and fit and match colors to assemble the end puzzle (on the screen) ... have it able to reprint guesses at missing pieces because there is always one.

      --
      you can't have everything, where would you put it?
  45. Heh by Dwonis · · Score: 0, Troll
    That's nothing! I can write a powerful 3D first-person shooter in *two* lines of python!
    import os
    os.execl("/usr/games/nethack", "doom4")
  46. Jigsaw solver? by Anonymouse+Cownerd · · Score: 1

    If a webcam and python had parts in this movie instead of the really bad actors they hired, it might have been a better movie.

    --
    http://www.rayn.net . Funny. Stuff.
  47. Re:This defeats the entire purpose of doing jigsaw by swiggidy · · Score: 1

    then having that work done automatically is self-defeating.

    Ask Jeff Breidenbach how self-defeated he feels

  48. Can it detect Dupes? by Anonymous Coward · · Score: 0

    It would be worth it even at 1000 lines of code.

  49. 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.

  50. Actually it doesn't by jab · · Score: 1

    Error correction codes are an important facet of DataGlyphs when one is trying to store a message. However, in this case there isn't any message stored - every glyphmark is devoted to purely positional information. This is called an address carpet, which is described in more detail in this
    IEEE article.

  51. MOD PARENT UP! by Anonymous Coward · · Score: 0

    neato.

  52. ahh yes... by Cryptnotic · · Score: 1
    Here's the source code to my awesome new FPS...
    #include "game.h"

    int do_game()
    {
    int dead=0;

    init_gamestate();

    while (!dead) {
    check_player_input();
    do_npc_update();
    update_screen();
    update_sounds();
    dead = is_player_dead();
    }
    }

    int main()
    {
    int done=0;

    init_stuff();
    main_menu(); // main_menu calls do_game()
    }
    Looks pretty good right? I just have to fill in a few unimplemented functions.

    --
    My other first post is car post.
  53. 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.

  54. MOD PARENT UP by dave1g · · Score: 1

    Seriously the summary didn't fit the article at all.

  55. Typical Slashdot. by bhima · · Score: 1
    A really interesting mental exercise with potential real world applications: The poster misrepresents it, the 'editors' don't edit it, and hundreds of uninformed people make comments which miss the whole point of the exercise.

    So Jeff, please don't listen to these fools.

    FOOLS... I know this is Slashdot... but go RTFA, and ignore the 200 line thing, it's a red herring.

    --
    Nothing in the world is more dangerous than sincere ignorance and conscientious stupidity.
  56. MOD parent up by Feztaa · · Score: 1

    funniest thing I've read all day.

  57. python??? by Anonymous Coward · · Score: 0
    obligatory python code excerpt:


    spam();
    spam();
    spam();
    egg();
    spam();
    spam ();

    ... and now for something completely different. :-)

  58. not true by old+man+moss · · Score: 1
    Under a perspective transformation with finite resolution images you can never be "precise enough".

    This is a harder problem than many people here seem to think. PARC have been working on this stuff for a long time to get it this robust.

    Shame it's still a solution looking for a problem...

    --
    rt
  59. Numerical Python by ajs · · Score: 1

    Can someone who knows Numerical Python clue in those of us not familiar? Is this akin to Perl's PDL? Just curious. It's the first time I've come across the term.

    In Perl, PDL is a wonderful tool, but it relies on some of those ancient fortran libraries that everyone (in the scientific community, anyway) has been dragging around since the dawn of time, and getting it to compile and install can be a bear.

    If Numerical Python does essentially the same thing, and is slightly easier to get up and running, I might toy around with it.

    1. Re:Numerical Python by Anonymous Coward · · Score: 0

      Numerical Python is a set of libraries providing fast, multidimensional, array processing facilities. I have no knowledge of the Perl PDL, so I can't provide any comparitive information.

      More information can be found at http://numeric.scipy.org/numpydoc/numdoc.htm

      and at:
      http://www-128.ibm.com/developerworks/linux/librar y/l-cpnum.html

    2. Re:Numerical Python by ajs · · Score: 1

      Yeah, looking it over it looks roughly the same. PDL incorporates much more on top of the primatives, but that could be seen as good or bad (personally, I'd prefer if much of PDL were broken off into seperate add-ons).

      Thanks for the info. I imagine all high-level languages go through this process of figuring out how to balance abstraction with number-crunching. Good to see two camps come to roughly the same conclusions independently, as it offers some credibility to both.

  60. What a cheat! by argent · · Score: 1

    From the title I thought this was actually going to solve the puzzle, not just do a lookup in a database. I was expecting something like a primitive version of the software Hiro used to reconstruct the tablet in Snow Crash.

  61. Ok? Where is it? Really? by Blitzenn · · Score: 1

    I don't see anything that actually solves the puzzle. I don't see anything that is even close to 200 lines of code. What's up with that? When you have to severly exagerate your claims to get people to look, then perhaps it wasn't worth looking to begin with. You can only sucker people so long before they absolutely stop believing you. Perhaps people at Slashdot are a bit more gullible than most? Nah, I don't believe it.

  62. Missing Pieces by kiick · · Score: 1

    What I want is a program that can scan in the picture on the box of the puzzle, along with some selected pieces, and then print out the piece that fell under the couch and was zapped into an alternate universe, never to be seen again. I think there would be some commercial potential for a "puzzle repair kit".

  63. Personally... by Didjeridoo · · Score: 1

    I find taking a jigsaw to stacks of old program code much more satisfying. I can make really cool paper dolls!

  64. Sensor Fusion by YodaToo · · Score: 1
    Seems this could be done without the DataGlyphs by using sensor fusion techniques. I did some work on detemining how two images overlap years ago as part of my masters project. It was slow, but it did work fairly well with very noisy images.

    If the computer had access to the full image, the code I was using could probably be modified to indicate where any give piece went. It handled translation and rotation so in theory, you could supply the piece to the scanner/web can at in any position.

    Used a hell of a lot more than 200 lines of code though and it wasn't pretty!

  65. Useful, but to who? by Parallax+Blue · · Score: 1

    It's interesting and could be useful but I'm not sure how many people would actually use it. This is probably generalizing but anyone that has enough technical expertise to get a webcam and set it up, then set up this jigsaw solver might be a bit bored with solving jigsaw puzzles in the first place.

  66. an addition by thedustbustr · · Score: 1

    Just keep in mind that linecount is not a measure of program awesomeness or programmer leetness: it is a measure of effort, and not a great one at that (in one particular project I've worked on, I've started mostly from scratch twice, and I've probably written 3 times as many lines of code that are actually part of the current branch. Of course, I'm not a professional coder; I code for personal pleasure... if a professional wrote significantly more lines than made it into the project, he is wasting company resources...

    --
    This sig is false.
  67. Haiku synopsis by AlpineR · · Score: 1


    Jigsaw robot is
    Genius solver of puzzles
    Only with barcodes