Open CV tracking juggling balls

Scratchpole's picture

A friend has asked if it would be possible to track juggling balls. The only method I know of would be to add a point for each ball with a mouse click. Any idea how to auto detect the balls when they enter the scene. Blob tracking? Colour recognition? I dunno.... What would happen if they were dropped or went out of frame?

I have found an academic paper on the subject which I have yet to read: www3.imperial.ac.uk/pls/portallive/docs/1/20673697.PDF

Any help much appreciated thanks.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

-polygon's picture
Re: Open CV tracking juggling balls

Sorry for this being kind of offtopic, but if you could emit IR light from the balls, you could track them with a wiimote. up to 4 balls + it doesn't remember the order of the balls(They don't have fixed indexes.)

gtoledo3's picture
Re: Open CV tracking juggling balls

Maybe you could try firing up TuioKinect, and see if you can get a clean enough result w/ the blob tracking on that.

It seems like it would be easiest to detect the motion of the balls using optical flow, or use an infrared cam like kinect, and then just "do something cool" with the image, or region of interest from that image. It would be hardest to have to make some kind of different object appear in a video feed right where the balls are, and keep up with the juggling.

Blob tracking can work pretty quickly, and maybe quickly enough to work, but it's iffy. The environment would have to be very controlled, and when the balls are in the guys hand, there has to be a robust way of differentiating them from the hands. Color might not be sufficient, because ambient light can play havoc on adjustments like that... they can work in extremely controlled testing and be hell in the real world. I don't know how I would handle that, I just know it would be a pain! :-)

That idea of having the balls emit IR or some kind of light might be a good one... it could help get a good clean threshold on the image. You probably aren't going to be able to emit different colors of light and detect those individually though, because the light will likely be very luminous and look basically "white" to color detection processes because of resolution limits and optics, I guess(?).

There could possibly be some kind of transmitter in each ball, but I don't think the resolution for that is available, and it would be some kind of custom deal I'd think. A non-optical solution would probably be most robust, but I can't really think of any.

I know that that method of "click on object, let it track" will probably drift pretty badly after not too long.

Scratchpole's picture
Re: Open CV tracking juggling balls

Thankyou both for your suggestions. I think IR is probably the way to go. Getting reasonable results from a .mov with glowing balls using Benoit's/Carasuelo's openCV blob tracking plugin. I hope to do some tests with a Kinect very soon as well.

bernardo's picture
Re: Open CV tracking juggling balls

if the problem is the balls why don't you track the hands?

bernardo's picture
Re: Open CV tracking juggling balls

or simply use different ammount of IR leds inside the balls...

Scratchpole's picture
Re: Open CV tracking juggling balls

I don't currently have any IR emitting juggling balls. I think they would have to be made for the project as I don't see any on the market. Maybe we can replace the LED's in standard glowing balls.

Still got the issue of what happens if they are dropped or move out of shot...but Dust has previously pointed towards some kick ass CV code which seems to get around this problem: http://youtu.be/1GhNXHCQGsM http://info.ee.surrey.ac.uk/Personal/Z.Kalal/ https://github.com/zk00006/OpenTLD/wikifor Looks like it is slotting directly into military applications to me, be good to give it a happier life.

bernardo's picture
Re: Open CV tracking juggling balls

yeah sorry I was thinking out loud...IR emitting juggling balls...