{"id":20447398,"url":"https://github.com/darwinsbuddy/foosball-ai","last_synced_at":"2025-04-13T01:08:30.662Z","repository":{"id":199969013,"uuid":"502141870","full_name":"DarwinsBuddy/foosball-ai","owner":"DarwinsBuddy","description":"Computer-Vision pipeline to track a foosball game","archived":false,"fork":false,"pushed_at":"2024-11-23T16:05:16.000Z","size":19029,"stargazers_count":9,"open_issues_count":7,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-13T01:08:24.140Z","etag":null,"topics":["foosball","foosball-table","opencv","python","tracking","wuzzler"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DarwinsBuddy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-10T18:22:48.000Z","updated_at":"2025-03-15T01:10:38.000Z","dependencies_parsed_at":"2023-10-14T21:32:04.382Z","dependency_job_id":"df9284d4-b1a9-48ee-88e3-4b44a8a9fd75","html_url":"https://github.com/DarwinsBuddy/foosball-ai","commit_stats":null,"previous_names":["darwinsbuddy/foosball-ai"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DarwinsBuddy%2Ffoosball-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DarwinsBuddy%2Ffoosball-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DarwinsBuddy%2Ffoosball-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DarwinsBuddy%2Ffoosball-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DarwinsBuddy","download_url":"https://codeload.github.com/DarwinsBuddy/foosball-ai/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650762,"owners_count":21139681,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["foosball","foosball-table","opencv","python","tracking","wuzzler"],"created_at":"2024-11-15T10:26:19.197Z","updated_at":"2025-04-13T01:08:30.656Z","avatar_url":"https://github.com/DarwinsBuddy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## foosball-ai\n[![codecov](https://codecov.io/gh/DarwinsBuddy/foosball-ai/branch/main/graph/badge.svg?token=ACYNOG1WFW)](https://codecov.io/gh/DarwinsBuddy/foosball-ai)\n[![Tests](https://github.com/DarwinsBuddy/foosball-ai/actions/workflows/test.yml/badge.svg)](https://github.com/DarwinsBuddy/foosball-ai/actions/workflows/test.yml)\n\n![Foosball AI UI](assets/bitmap.png)\n\n\u003cimg alt=\"example gif of a tracked goal\" src=\"https://github.com/DarwinsBuddy/foosball-ai/blob/main/misc/example.gif\" width=\"25%\" height=\"25%\"/\u003e\n\nThis software is designed to take a camera feed or a video file as an input of a match played\non a foosball table (🇦🇹 Wuzzler), track the ball and count goals.\n\n## Features\n\n* Support for different streaming backends ([imutils/opencv](https://docs.opencv.org/4.x/d8/dfe/classcv_1_1VideoCapture.html), [VidGear](https://abhitronix.github.io/vidgear/latest/)) for capturing\n* Preprocessing\n  * arUco marker detection for roi estimation and cropping to improve performance\n  * goal detection build on top of arUco detection (done every other second to compensate table movement)\n* Ball tracking\n  * frame-by-frame analysis of rgb/bgr stream\n  * ball detection by color masking (can be calibrated for different ball colors)\n  * ball track (adjustable length) to analyze later on\n* Analyze\n  * [X] detect goals on either side\n  * [ ] TBD: detect middle goals (they won't count in 🇦🇹 tavern rules)\n  * [ ] TBD: estimate ball speed\n* Hooks\n  * `playsound` providing support for playing a sound on 📢 goal 🎉\n  * webhook support for triggering something different (or counting goals on a [separate](https://github.com/5GS/foosball) [system](https://github.com/5GS/foosball-ui))\n* Rendering\n  * optional, since `headless` mode is also supported\n  * show detected goals, basic stats, ball track, current score\n  * [ ] add VidGear streaming support to live stream\n\n## Prerequisites\n* python3  \n* pip\n* opencv\n  \n## Install  \n\n0. Prerequisites\n  * Mac OS (suggestion)\n    ```commandline\n    brew install pyenv pyenv-virtualenv\n    pyenv install 3.11\n    pyenv exec pip install\n    brew install opencv\n    ```\n  * Linux\n    * Ubuntu `sudo apt-get install python3 python3-pip python3-opencv`\n    * Arch `pacman -S python python-pip opencv`\n\n1. Setup a venv  \n    ```#!/bin/sh  \n    python3 -m venv ./venv  \n    ```  \n2. Activate venv  \n    ```#!/bin/sh  \n    . ./venv/bin/activate  \n    ```  \n3. Install requirements  \n    ```#!/bin/sh  \n    pip install -r requirements.txt  \n    ```\n## Run  \n0. (optional) Download video\n   - [demo video](https://mega.nz/file/UpNSwaBY#7__EPElzGkf6ohM_Oe5kxjJpIV2TUmJ8k63HJV0X4oU) (w/ yellow ball)\n   - (optional) [calibration video for camera calibration](https://mega.nz/file/w98z3ABK#e6rwmejpqAgv3Ipc5CqkkAjdf-M0NEEtcTlGkSc4hUo) (w/ yellow ball)\n1. Activate venv (if not already done in the **Install** step)\n    \u003e ```#!/bin/sh\n    \u003e . ./venv/bin/activate  \n    \u003e ```\n2. Run camera calibration (optional for demo)\n    \u003e You can skip this step if you chose to download above demo video, since the provided `calibration.yaml`\n    \u003e is already tailored to the recorded video's camera\n    \u003e ```#!/bin/sh  \n    \u003e python3 -m foosball -c cam -cv \u003cpath-to-calibration-video\u003e.mp4\n    \u003e ```\n3. Run\n    ```#!/bin/sh  \n    python3 -m foosball -f \u003cpath-to-file\u003e.mp4\n    ```\n## Misc\n### Calibration\n#### Color\nColor calibration is needed for the ball (or the goals) to be detected.\nThere are 2 preconfigured ball profiles and 1 goal profile available, accessible\nby a cli option. For individual options please refer to the calibration mode where you can select the color range to \nbe detected and stored in a color profile accordingly.\n\n\u003e `ball`/`goal` calibration mode\n\u003e ```#!/bin/sh  \n\u003e python3 -m foosball -f ./demo.mp4 -c [ball|goal]\n\u003e ```\n\n#### camera (aruco)\n1. Generate Aruco Board\n   \u003e ```#!/bin/sh  \n   \u003e python3 -m foosball -a\n   \u003e ```\n2. Print it in DIN A4 format (`aruco.png`)\n3. In order to automatically detected the aruco markers and thus\nimprove performance and accuracy, for each camera an initial calibration has to be done.\nOnce run this application with calibration mode `cam` and present the printed out version of\nthe generated aruco board to the camera by\n- waving it sturdily in different angles in front of the camera,\n- provide the path to a pre-recorded version of it\n- or provide a path to a set of pre-recoded images of it\n\n\u003e`cam` calibration mode\n\u003e ```#!/bin/sh  \n\u003e python3 -m foosball -c cam -cs 50\n\u003e ```\n\n## License\n\n![CC-BY-NC-SA](https://github.com/DarwinsBuddy/foosball-ai/blob/main/misc/cc-by-nc-sa.svg)\nThis software is licensed under CC-BY-NC-SA","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarwinsbuddy%2Ffoosball-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarwinsbuddy%2Ffoosball-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarwinsbuddy%2Ffoosball-ai/lists"}