Saturday 11 July 2015

Ping-Pong game using Object Tracking

I thought of this project way back but had to pause working on it for about a month. So when I sat free again, I finally made it work the way I wanted. (Needs debugging though)

This project has three modules:
1. A C program of Ping Pong
2. Real time Object Tracking using MATLAB
3. Integration of MATLAB and Visual Studio using Engine API.

If you visit my older posts, you may find enough description of Object Tracking and Engine API (I remember I have to write the other part of Integration tutorial, it will be soon). The remaining one, Ping Pong game, was not very hard to make. You just need to make four independent objects, two bats, a ball and a game arena and keep them displaying at every loop.

The important logic behind the motion of balls is the direction x and direction y. When the ball hits the walls, its y direction will negate but its x direction is same. On the other hand when hit by a bat its x direction changes while y remains same. This is enough to design a simple Ping Pong game. You can go through the code at my github link posted at the end.


This video was taken a few hours after my code gave the first desired output. The results have a lot of errors still, but it is just a prototype. Given some time I can try to make it as flawless as possible.
The only part to explain is the integration of both softwares, which I shall post soon. Hit a +1 if you liked it and do comment out your views and suggestions.

Here's the github link, Ping-Pong-with-finger-tracking-

No comments:

Post a Comment