Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Slashdot Log In

Log In

Create Account  |  Retrieve Password

Python + Motion detection = Fweemote

Posted by timothy on Tue Dec 25, 2007 03:01 PM
from the help-tom-cruise-find-future-crime dept.
jedie writes "After reading about different Wiimote hacks on Slashdot I decided to make a video with some demos of my motion-detection library. You can watch the video here. There's a link to the sourcecode (GPL) as well, but the demo is win32 only. It's basically a webcam and some software in python to track LEDs (preferrably IRs). In the demo video, you see the software (albeit badly because of the webcam's IR filter being removed) tracking two differently colored LEDs, so multiplayer is possible. The software can track multiple points easily, and when combined with IR-LEDs, it's easy to simulate one Wiimote (i.e. calculating the distance and angle between two IR-LEDs to determine where the remote is relative to the webcam). I want the code to get some publicity, because I don't have time to work on it (dissertation, blabla) but I don't want the code (however messy it is) to go to waste."
+ -
story

Related Stories

[+] Wiimote as Multi-Touch Display Controller 107 comments
Tmack writes "While hard-hacks with the Wiimote are somewhat old news, this particular implementation is quite interesting. Using the infrared camera on the Wiimote, pens with LEDs instead of ink, and an LCD projector, Johnny Chung Lee of Carnegie Mellon University has created software to use them as a (relatively) cheap multi-touch display. Any surface onto which you can project becomes an interactive multi-touch display, as demonstrated in the video at the link. He has the software available for download, along with some other neat projects. Lee has also documented another impressive Wiimote hack.
This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More
Loading... please wait.
  • This is not surprising, since I was unable to find any really good Linux python webcam libraries (and by really good, I mean, any that I could get to work).
          • It encourages spam of forums. Likely for extra hits from unique IP addresses for ad purposes. The people who are spamming are effectively working for that website, even though they think they are playing a game. Kinda ingenious, but still annoying nevertheless.
      • Re: (Score:2, Informative)

        Christ! Thats not a myminicity, thats a goatse. BEWARE!
    • by delire (809063) on Tuesday December 25 2007, @04:51PM (#21816886)
      What's wrong with the Python interface to Intel's immensely popular OpenCV [opencv.org]. Firewire devices, USB, multiple cameras.. all are a breeze on Linux or those-other-two-popular-OS's.

      Using a Debian-based system as example:

      apt-get install python-opencv

      In a Python interpreter do:

      from opencv import cv

      then:

      help(cv)

      .. and prosper.
      • Apparently, it's not very good at letting me know it exists =P. Thanks, I'll give it a whirl.
      • Re: (Score:3, Informative)

        I hear that. Anyone with any real knowledge knows that these days language is mostly a matter of preference. Of course, Python is my language of choice and I do love how beautiful the code looks no matter how convoluted you try and write it.

        raw = os.popen('dir /B').read().rstrip().split('\n')

        To be perfectly honest, however, I use certain languages for different things. Rather, I use Perl for IM stuff (AIM, IRC, etc), PHP on my sites, and Python for those two plus everything else including a teaching tool

        • So what exactly does that code do? Read an entire directory contents and store the results into an array? The code might look beautiful, but it's no wonder now why python's a memory hog if thats how people use it.
          • Well, in all fairness, maybe he simply wanted to have the contents of the directory in an array, regardless of the language used? After all, all languages give you the ability to do things in a silly or inefficient manner. Some just look worse than others while doing it ;)
          • Re: (Score:1, Insightful)

            by Anonymous Coward
            I'm sick of people talking about how slow and memory-abusive Python can be. It has changed quite a bit since those negative reviews came out 8 years ago.

            Compare it to PHP on the infamous Language Shootout site and you'll see Python is better in every way:
            http://shootout.alioth.debian.org/debian/benchmark.php?test=all&lang=python&lang2=php [debian.org]

            The same site shows that for both speed and memory use, Python is really better than most other languages. It even beats plain C++/gcc and C# on string manipulation
            • Comparing to PHP is like shooting fish in a barrel.

              Try this one [debian.org] on for size.

              All the crap Pythonites love to boast about and almost universally faster. I'd be careful using the Shootout as a reference though, as not every language gets the love it needs to get a fair shake in such comparisons. In the Python case, Regex DNA has seen some serious love that picked the best concepts from the other implementations in the pursuit of speed. Its place in the ranking is likely not a matter of libraries, as it uses th
          • You can do the same thing in Java and C# if you would like. Seriously. I wonder if you have any proof that Python is a memory hog.
          • Re:If only (Score:4, Funny)

            by JohnFluxx (413620) on Tuesday December 25 2007, @06:15PM (#21817344)
            > I don't program in any version of C cuz I can never type those damn square brackets [] correctly

            You can't write 'because' either.
          • It depends on what you're comfortable with. I know a more C than VB, more Perl than C, more Python than Perl. Certain languages may be easier (from whatever point of view) but that doesn't mean they're easier for everyone. Some people do write backbone apps in VB, and some write simple little squirts of software in C. I'm not saying it's a good idea (because I do agree with you) but for some it's just easier to stick with what you know.
        • I do love how beautiful the code looks no matter how convoluted you try and write it.
          Yes, very convoluted, and not portable out of Win32.
          Have you tried this:

          import dircache
          dircache.listdir('.')
          • Well yeah, I picked that little snippet because it's a bunch of functions strung together. I can understand some people finding it a bit confusing, but any Python programming with real experience can look at the line I posted and know exactly what it does within a couple seconds. Well, unless they don't know what "dir" does. Even the popen code can be figured out in context.
            • Well yeah, I picked that little snippet because it's a bunch of functions strung together. I can understand some people finding it a bit confusing, but any Python programming with real experience can look at the line I posted and know exactly what it does within a couple seconds. Well, unless they don't know what "dir" does. Even the popen code can be figured out in context.

              ...except that, from context, you weren't trying to give an example that Python programmers could understand...

              Besides, chains like th

        • "I do love how beautiful the code looks no matter how convoluted you try and write it."

          if code aesthetics are really important to you, they you really must go with basic.

          10 CLS
          20 PRINT "Hello world"
          30 END

          Look at the beautiful symmetry!
          Look at the even row of numbers in one column, and how they prop up the commands sitting beside them.

          I must say, BASIC code is truly an example of sublime beauty.
          I pity the fool who codes in Python.
        • raw = os.popen('dir /B').read().rstrip().split('\n')

          Convoluted is exactly how I'd describe that horrible piece of buggy, platform-specific code that should be replaced by:

          raw = os.listdir(".")
  • Congrats (Score:3, Insightful)

    by EmperorKagato (689705) <sakamura@gmail.com> on Wednesday December 26 2007, @09:25AM (#21820982) Homepage Journal
    However, the C# version was already done by Johnny Chung Lee [cmu.edu]

    "Betta step up yo game"
    • yes, it's pretty much the same except there is no wiimote in this demo
      I'll put up a video of multiple point tracking as well I suppose