jacob andreas [.net]

Virtual Bouncing Ball with OpenCV

December 13, 2008

More games with red gloves and a webcam.

As always, it’s dead simple: regions of the image are cut off at a specified threshold and the contours are identified. A very small (and rather poorly implemented) physics engine then bounces the ball off the identified contours. It’s surprisingly fun to play with.

Collision detection algorithm cribbed from http://blitzbasic.com/codearcs/codearcs.php?code=998, and the angle of reflection calculation was accomplished with a little help from http://www.gamedev.net/community/forums/topic.asp?topic_id=61069.

Since I’m feeling organized, the code is already available here

Enjoy!

No Comments (Jump to form)

Leave a comment

Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

fine print

All content in public domain unless otherwise specified. Powered by prgmr, FreeDNS, Wordpress and vim.