Virtual Bouncing Ball with OpenCV
December 13, 2008More 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!
Comments RSS / Trackback
No Comments (Jump to form)