Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use an iSight as a basic remote control device Other Hardware
My wife and I like watching iTunes videos, but wish we had a remote control for our iMac G5 to pause playback from the couch. So I hacked up this crude script, which lets you toggle iTunes playback with iSight and a flashlight. It uses Dethe Elza's PySight, a Python wrapper around Tim Omernick's CocoaSequenceGrabber.

To make this work, you will need to install both the Developer Tools and
PyObjC. For the stock Python install on 10.3 and 10.4, use PyObjC 1.3.7.

Download PySight, and compile the included CocoaSequenceGrabber to your /Library/Frameworks directory. To compile, open the CocoaSequenceGrabber.xcode file in Xcode, choose 'Upgrade a copy' in the Project menu, set the the Active build configuration to 'Deployment,' click the Build button, and then after compilation is complete, copy the CocoaSequenceGrabber.framework folder in build/Deployment to /Library/Frameworks). The PySight folder that is inside the downloaded PySight folder should be installed to your Python site-packages directory: /Library/Python/2.3/site-packages/

You can test installation by running Python in the terminal, python, and then trying >>> import PySight. If you don't get any errors, you should be good to go.

Your iSight will need a diffuser. I thought I could simply wrap a piece of tissue paper or a thin piece of white plastic around the lens, or just point it at a blank white wall, but iSight then continually and unsuccessfully tries to focus. You don't want to burn out your iSight, so you will need to point it at something that will diffuse and reflect the flashlight, but has enough detail that iSight can successfully focus. Try a piece of paper with a cross on it.

To use this python script, copy it to /usr/local/bin, name the file whatever you want (e.g., controller), make it executable (chmod +x controller), and then you can run it by typing its name in Terminal. Flashing your flashlight on the iSight target will toggle iTunes on and off (my flashlight batteries were dead, so I used a camera flash unit instead -- jarring yes, but it worked). Changes in light levels for other reasons, like turning the room lights on or off, will obviously toggle iTunes, too. To stop the script, type control-C.

You will probably need to adjust the self.threshold variable in the script to get decent performance. Also, the 'playpause' iTunes AppleScript command doesn't seem to work well when playing videos fullscreen, so you will have to play videos in their own window.

I am not a Cocoa expert, Python expert, or a signal processing expert, so the script could no doubt be improved considerably. It's main value is to show how easy it is to grab frames from an iSight for use in Cocoa / Python code.

[robg adds: Obviously, there are simpler ways to remotely control your Mac, but you must admire the creativity in this solution -- and as noted, the hint mainly demonstrates how to grab frames from an iSight camera via a script. I have not tested this solution (I took the easy route and bought a USB-based remote!).]
  • Currently 1.20 / 5
  You rated: 1 / 5 (5 votes cast)

Use an iSight as a basic remote control device | 3 comments | Create New Account
Click here to return to the 'Use an iSight as a basic remote control device' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use an iSight as a basic remote control device
Authored by: blubbernaut on Oct 04, '06 04:18:22PM

Thanks MacGyver!! :)

[ Reply to This | # ]
Use an iSight as a basic remote control device
Authored by: taxi on Oct 05, '06 12:39:17AM

Next up: how to control every application using a series of flashes - looks like Morse code might make a comeback!

[ Reply to This | # ]
Use an iSight as a basic remote control device
Authored by: ever on Oct 06, '06 06:38:33AM
Ahh.. that iSight gets more and more useful every day. If you liked this you may also be interested in EvoCam's ability to run AppleScripts when a threshold of motion is detected on hotspots you place in the iSight frame. I've used that for lots of things, from alerting me to the mail truck to rapid-scanning index cards. See pic...

[ Reply to This | # ]