How to track objects on a table?

Hello!

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.

e.g.

2 Likes

@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: http://stackoverflow.com/questions/7879318/save-opencv-descriptor-matcher-after-training-with-ferns-descriptor

2 Likes

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: https://github.com/TheArtvertiser/TheArtvertiserCombined/tree/master/common

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 https://github.com/TheArtvertiser/TheArtvertiserCombined/tree/master/common/cv

and the modified ferns library: https://github.com/TheArtvertiser/TheArtvertiserCombined/tree/master/common/ferns_demo-1.1

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 (https://github.com/mrnugget/opencv-haar-classifier-training 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: http://computer-vision-talks.com/2012/08/a-battle-of-three-descriptors-surf-freak-and-brisk/ ) or more accurate if you need to find one of many images (more info here: http://answers.opencv.org/question/8677/image-comparison-with-a-database/#8686). 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.