Using a webcam for infra-red sensing

Let's say you want to use live video as an input source for an installation, multi-touch screen, or some other purpose. You've got software, such as Processing [see the Computer Vision libraries], Lingo [the TTC-Pro XTRA by Dan Rozin], or Actionscript [Adobe technote], which can do video analysis, "blob detection", brightness tracking, etc. Now you need a good video source.

Older webcams like the one I hacked had much less resolution than newer cameras. So consider how much detail you really need for your application. If you're tracking amorphous blobs, low-res should be fine.

Another issue, older webcams may not be automatically recognized by your computer. New Macs need help detecting units like this Quickcam. I found this great app and component to be the answer. All my video software was able to find this old webcam using the "macam" driver. (Processing did sometimes need to be restarted while I was editing the code, however.)

You will want to control the area viewed by the camera to give you only the motion information you need. [This fantastically detailed site by Thomas Brand explains a particular way of using IR LEDs for detecting finger-touches on a plastic screen.] Sometimes using infrared light is the best solution. You'll need a camera that sees in infrared, and a source of infrared light.

The steps:
1. Remove the built-in infra-red filter, present in most cams.
[See my description here.] OR... Purchase a camera designed for infrared vision. [This manufacturer has a good selection of modern, compact firewire camera boards and lenses.] [One place to buy them is here.]

2. Add a filter which blocks visible light. This will keep stray illumination in the scene from confusing your software. A double or triple thickness of fully exposed color negative film is amazingly effective.

Film clipped to cam as a visible light filterFilm clipped to cam as a visible light filter

OK this is pretty temporary, but you get the idea.
3. Find an infrared illumination source. [See my links for some IR light sources and cameras.] I found this supplier who has an inexpensive kit for a small "spotlight". It took me a couple of hours to solder the parts. Not bad. But I found this creates an intense narrow beam, and I wanted something broader, so after trying various materials, I found the diffused plastic of a miniDV case pretty effective.

IR LEDs, with a miniDV box as the diffuserIR LEDs, with a miniDV box as the diffuser

4. Experiment with the space. You will notice that daylight and some forms of lighting do contain some infrared. Aim the light from the infrared LED array to brighten the area where you need to detect motion.

Room in visible lightRoom in visible light

Here's the same illumination through the IR-only webcam:

Room through IR filter on modified webcam, no IR illuminationRoom through IR filter on modified webcam, no IR illumination

Turning on the IR illuminator does brighten the wall 8 feet away somewhat:

Room illuminated by IR leds through IR filter on modified webcamRoom illuminated by IR leds through IR filter on modified webcam
IR-only webcam with IR LEDs "spotlight"IR-only webcam with IR LEDs "spotlight"

The beam from the illuminator helps distinguish nearby objects.

Hand and arm in beam of IR ledsHand and arm in beam of IR leds

Have fun and be patient!


Back to top