How to track objects on a table?


I’m making an installation where people can play card games. I need to be able to track the cards on a table. When the a card is put on the table it needs to get a name (already stored as a string using tesseract and edsdk to scan the card), a rotation state and some other variables, that can be changed during the game.

I looked a bit at the opencv example but since the cards are very flat, I’m not sure how well it would work. On the other hand there is a big contrast between the cards (black outline) and the table (white).

I have been working with kinect before, but that has only been for tracking people and no objects.

Is there an addon that can easily track objects (assign id, check when they enter, leave and rotate)?

I’ve been working with fiducials before and those works great, but it would be optimal if i didn’t have to mark the cards with a tracker pattern.

There is probably a good addon by now (although I can’t find it), but OpenCV’s cvExtractSURF might be useful to you.



@jefftimesten do you have any thoughts?

1 Like

I haven’t looked into this in a little while, but the last technique I uses is Theo’s Fern implementation described here: Planar object detection - which technique to use?

I cooked up an example here: Boards - Interactive Magazine Cover

FWIW: I could be completely wrong here, but I think that project was done back in the OpenCV 1.x days, and Theo had to use an external implementation of the Fern matching. However, it seems like it’s now built into OpenCV 2.x.

Check this out:


i tried the opencv version a while ago, it might have get better but it was really slow compared to the GPL reference implementation

i did some fixes over the original implementation here:

mostly to fix memory leaks and crashes on destruction…

the addon is mixed with the project but it should be easy to separate, you just need the ofxFerns class in

and the modified ferns library:

1 Like

Thanks a lot! There is definitely a lot of things to look into.

Theo’s fern implementation is awesome, looks very smooth. Might be a bit hard to do, if it is old and unsupported.
Will try and get arturo’s method working and see how it goes, else i will have to look more into cvExtractSURF.

1 Like

Depending on the cards/images there’s a bunch of different approaches. If the images are very different then you can train up a haar recognition file ( is a helpful utility). If you’re going to use feature detection and don’t mind using Kyles ofxCv addon then you can leverage some of the newer feature detection techniques which all have funny names but are generally faster than SURF for tracking something through space (some info here: ) or more accurate if you need to find one of many images (more info here: I have a ton of code for all this kind of stuff written unfortunately using cough a different framework that I’d be happy to point you at and try to help you with if you need.