I have started to build a tablesoccer Video analysis with openCV, Python and a Basler camera. For now, I have realized the basic structure for the analysis, ball tracking, field detection, goal counting and ball speed calculation.
Table Soccer Video Analysis with OpenCV in Python - Basler dart / pulse Camera connected with PyPylon
During my own websearch couple of weeks ago I found some impressive demonstrations of video analysis setups for table soccer matches. But sadly none of those mostly university groups have published their code.
So not that long ago I began coding an OpenCV based ball-detection as a first step realizing the project. It became clear pretty fast that I won't be able to do all of the coding by myself, so I decided to release the project to all of you already although there still is a lot of work to be done before the project could somehow be called as "finished".
This is my setup.
I’m using a Basler pulse camera positioned about 1.5 meters on top of the soccer field for filming the field area of the table. I had to crop the sensors image to increase the framerate. The downside of that is that I now need a vocal length of about 4mm.
On the script side I decided to use Python for some straight forward results combined with the OpenCV library for image recognition.
To get the raw camera image I’m using a Python wrapper for Baslers C++ API, which allows me to configure all advanced camera settings within the code.
I focused a lot on writing the project code in a as modular way as possible so it will be easy to adapt new awesome features you might want to add to it.
So here's what I've done for now
Currently there are two main classes. One is detecting the field with its orientation, size and goal area position. It also creates a pixel per inch ratio for things like speed calculation. The second is responsible for the calibration and detection of the ball. It can detect most ball colors. The color just has to be different than the field colors.
Obviously there is plenty of work to do and probably you have even more great ideas what can be done for a great user experience. Here I some ideas which I would like to implement if I have enough time in the future.
TableSoccerCV is hopefully just the beginning of some great Open Source table soccer video analysis projects. I hope you find my code useful! Cheers, StudentCV
0.1 - PreRelease
You will need the following packages for python to get the code working:
Want to contribute? Great!
The code itself is documented within the source code as much as possible. I'll also provide a short coding manual asap.
Feel free to add some great functionalities!
|StudentCV||pushed dcead6a3b53f959a2264a4f7372b3a9b6904b476||2016-08-19 10:59:33 UTC|
|StudentCV||pushed aca6942d760c06c5325cadc3dc657a5927786db6||2016-07-15 07:59:55 UTC|
|Pries, Dennis||pushed 76cb94f0a8626cc8e6b13303615d18ecc348ca7d||2016-05-20 14:17:43 UTC|
|Aerotow||pushed 83f7ed409212fa940c97f99339aaf12dab56dd71||2016-04-14 10:12:07 UTC|
|Aerotow||pushed fd0f00825ef4efbfa82ab8213cf34f2d55acbb9b||2016-04-07 09:01:44 UTC|
|Aerotow||pushed 1f115ae49b015876298ef005003ea62b69257ea2||2016-04-07 08:06:38 UTC|
|Aerotow||pushed 22ee4fa92380d204840af761204921ced6ea9147||2016-04-07 07:59:26 UTC|
|Aerotow||pushed 39cf666485dcbae56032648cbe188b31cca42464||2016-04-07 07:17:02 UTC|
|Camera Stand||Schematics for the construction of a customized camera stand|
|Sample video||A sample video of a foosball game||.avi|