Ask Your Question

Tracking an Infrared LED or?

asked 2016-05-16 05:48:26 -0500

dmen gravatar image

Doing a project at work and we need to have a user hold a stick. We need to track one end of this stick in real time and place a 3D particle system at that point. A HD webcam will record to a video that the user will receive.

My plan to do this: Unity as the 3D engine, it has an OpenCV plugin, and can use multiple cameras. We will place an IR LED at the end of the stick. I think to use two webcams - one modified to see just IR - I removed the IR filter and added a piece of floppy disk over the CCD and it sees IR well. I will use simple blob detector to track the IR point and get X,Y position. Then use that to position particle system in the actual video being recorded by a second, HD webcam.

Hoping for a little guidance now. I need the tracking to be spot on as possible. I'd love to not use two cameras though, but I'm not sure about tracking accuracy though. Color is out as I can't know what the user will wear, other people around, etc. IR seems good... but couple problems.

I have it working now tracking the IR but the camera can see some daylight, reflections of IR etc. and I don't know how to get just that one point I need? Would I need to get a min/max area or something and then only that blob size will work? So user would have to be correct distance from camera?

Any help much appreciated.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-05-16 18:27:47 -0500

Tetragramm gravatar image

There are two problems. One is the background IR that isn't from your signal. The second is the reflections of your signal that are false positives.

If your environment doesn't change very fast you can use a simple background subtraction algorithm to remove that. MOG2 or one of the other subtraction algorithms in opencv should handle that.

For false positives you can be more proactive. You know that your stick doesn't jump from one place to another instantly or move too far between frames. Use a Kalman filter to track its motion and exclude any measurements beyond a certain distance from where it is. This should be independent of size, so you don't have to worry about that.

edit flag offensive delete link more


Hi, thanks for the info! To remove background noise I did a threshold on the image to filter out non white pixels. At least in testing I'm only seeing the one blob I need.

But yeah, for false positives... the Kalman filter could work. However part of my problem is that I don't think I get data fast enough for that to work? I think I get around ten frames per second from the QuickCam. I'm going to try and modify a better camera (logitech c920) and see if I can get faster input.

dmen gravatar imagedmen ( 2016-05-17 06:22:31 -0500 )edit

Hmm, that could be a problem. I would also suggest using the moments. Reflections and the like will probably have different shapes or intensity profiles, which the moments can detect. I would not use the binary version, just use that as a mask.

Tetragramm gravatar imageTetragramm ( 2016-05-17 18:13:40 -0500 )edit

Question Tools

1 follower


Asked: 2016-05-16 05:48:26 -0500

Seen: 3,556 times

Last updated: May 16 '16