Skip to content

Analysis of table soccer games based on video recordings

Notifications You must be signed in to change notification settings

mtszkw/foosball

Repository files navigation

Foosball Build Status License: MIT

Foosball is an open-source application created by students for academic purposes. It allows to process and analyze video recordings of table soccer games and:

  • detect a table (using Aruco markers placed on table),
  • detect and track a ball,
  • detect red and blue players,
  • count score (based on ball motion and position)

You can watch this demonstration video (click here for original raw input video) too see how it works in practice. In section at the bottom of this page, you can also find a few screenshots from the video recording in different phases of processing.

Requirements

  • C++17 compiler
  • OpenCV == 3.4.1 (not tested on newer versions)
  • CMake >= 3.10.0 (not tested on newer versions)

Configuration

After you build the project using a build system of your choice, an executable binary file created requires JSON config file named configuration.json to work. Sample configuration can be seen in config_example.json file which contains all the options needed to run the application (see exaplanation in the table below). You use that file or copy it to create your own configuration with other values.

Parameter Short description
videoPath A path to game video file
videoSkipFramesStep If video FPS rate is too high, it is possible to skip `x` frames after each processed frame
arucoDictionaryPath A path to black and white bitmap images with aruco symbols
arucoDetectorConfigPath (optional) A path to YAML file with aruco detector parameters (see [OpenCV documentation](https://docs.opencv.org/3.4.1/d1/dcd/structcv_1_1aruco_1_1DetectorParameters.html))
calibPerformCalibration If true, camera calibration will be performed at the beginning
calibConfigPath TBD
calibInitConfigPath (optional) TBD
gameTableWidth Width of the output image with table
gameTableHeight Height of the output image with table

Screenshots

Source video frame

Undistorted video frame

Result video frame