IR-LED tracking/blob identification (Processing)

Hello everyone,

after reading Tom Igoe’s “Making things talk” I got interested in what you can do with a standard webcam in terms of motion/position detection.

Remembering Johnny Lee’s amazing work about IR-tracking with a wiimote ( tried to do something similar in Processing (as interfacing with Arduino is so easy).

I tried using the JMyron library, which didn’t work for me (as it only uses the standard video source, which is my video capture card, and I didn’t want to disable it…), so I spent two days in Processing to come up with my own little sketch:

It contains a raw version which is quite slow, called “IR_tracking_work_try_some_sorting_5” where you can see the single processes in action.

There is also a more finished version, which works quite fast, called “IR_tracking_v_1”.

Both versions are there as Processing-Sketches, Windows-, Mac- and Linux-executables (only Windows tested).

To prepare my webcam, I built a filter from old 35mm-film:

Cut to pieces (big enough to cover the lens) it looks like this:

If you layer them, you can see how the film blocks visible light, but lets IR-light pass through (no filter, 1-6 layers):

Tape the layers together and tape them in front of your lens.

Shoot a tree :wink: (here only 3 layers of film):

Build, download and have fun!



Just saw your post and am thrilled :slight_smile: but I was a bit late - the file’s already gone from rapidshare…

Would you mind uploading the file again?
I would like to have a go at it using a PS2 eye-toy cam and see if I can use it for monitoring an ir-lit environment.

Thanks so much in advance!

Here you are:

That’s the old version. There were some versions I created after that, but my camera is broken and I can’t really check what I did there. You can dig through it and look if it’s useful to you:

The old release only contained blob recognition, what I did then was add Blob Identification, so if you move more than one blob around, the program tries to keep track of which one goes where.

If you have any questions (regarding weird comments or stuff), feel free to ask me and I’ll look into the sources.

You should try using a floppy disk film to block the visible light instead of that photo films. It works great, and only one is needed.
Some time ago I removed the IR filter from a Logitech QuickCam Pro 4000 and put a floppy disk in front of it. The camera already saw IR but with the internal filter removed, it became perfect.
It’s very easy to remove the ir filters BTW.

those multi-layers of film aren’t necessary as well. if you can get an undeveloped film one layer should be enough. I didn’t have a new one laying around though, so I used some developed, old negatives.

Very interesting, good work Otacon2k

I’ve been digging around for things like this and found the Wii Remote seems to have some tidy features like the IR blob tracking in hardware?

Good stuff, Thanks!

Yes, as far as I know it is able to track 4 blobs with its special dedicated hardware.

The files are not online anymore.
Can you send them to me? I’m very interested.

Hello! I am very interested in this as well. Can you re-upload your programs please?

Hi. I am also very interested having a look on your processing sketch. Thank you.