Giter Site home page Giter Site logo

snooker-ball-tracker's Introduction

Snooker Ball Tracker

This project is a prototype that I developed in Python to demo an idea I had for a program that could automatically detect and track Snooker balls on a Snooker table. The program would therefore be able to automatically score points based upon which ball was potted.

The program allows you to configure all the settings that are used by the ball tracker, from how it detects colours to how it detects balls. It also provides features that allows you to see what the ball trackers sees.

Requirements

From source

  • Run poetry install to install all required modules and dependencies
  • Run poetry shell to activate the python virtual environment;
  • Run sbt-image to run the image CLI or;
  • Run sbt-video to run the main video GUI

From an executable

  • Run poetry install to install all required modules and dependencies
  • Run poetry shell to activate the python virtual environment;
  • Run python build.py to create single file executable (Bundles Video GUI only)
  • Generated executable should be available in dist/

Video GUI Examples

The Video GUI provides an interface to allow you to configure the ball tracker in real-time as the app is processing video. Currently only supports pre-recorded video.

Interface screenshot

Video Example

Image CLI Examples

The Image CLI supports processing images.

Image 1

sbt-image resources/images/image-1.jpg --settings resources/config/image_1.json

Image 2

sbt-image resources/images/image-2.jpg --settings resources/config/image_2.json

snooker-ball-tracker's People

Contributors

danthewaann avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

snooker-ball-tracker's Issues

BallTracker' object has no attribute 'perform_init_ops'

Hi team,

I'm trying to run your code to detect ball in images but get the error below.
Traceback (most recent call last):
File "ball_tracker_cli.py", line 273, in
_, _, hsv = ball_tracker.perform_init_ops(frame, width=args.width, morph=args.morph, crop=args.crop)
AttributeError: 'BallTracker' object has no attribute 'perform_init_ops'

Could you tell me what i did wrong? Thank you very much!

Issue with 'poetry install' when installing required modules and dependencies

Seemingly doesn't like opencv-python and pyqt5 versions:

Installing opencv-python (4.5.2.52): Failed

RuntimeError

Unable to find installation candidates for opencv-python (4.5.2.52)

at ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\installation\chooser.py:109 in choose_for
105│
106│ links.append(link)
107│
108│ if not links:
→ 109│ raise RuntimeError(f"Unable to find installation candidates for {package}")
110│
111│ # Get the best link
112│ chosen = max(links, key=lambda link: self._sort_key(package, link))
113│

• Installing pre-commit (2.17.0)
• Installing pyinstaller (4.5.1)
• Installing pyinstaller-versionfile (2.0.0)
• Installing pyqt5 (5.14.1): Failed

ChefBuildError

Backend 'sipbuild.api' is not available.

at ~\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\installation\chef.py:152 in _prepare
148│
149│ error = ChefBuildError("\n\n".join(message_parts))
150│
151│ if error is not None:
→ 152│ raise error from None
153│
154│ return path
155│
156│ def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with pyqt5 (5.14.1) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep517 "pyqt5 (==5.14.1)"'.

• Installing pyqt5-stubs (5.15.2.0)
• Installing python-magic (0.4.24)
• Installing tomlkit (0.7.2)

Can't run on Ubuntu 20.04

Hello Daniel! Great work on developing this app :)

I've followed all steps but cannot get it to run on Ubuntu 20.04. I get the following error:
Traceback (most recent call last): File "/home/ricardo/.local/share/virtualenvs/snooker-ball-tracker-YBvYRYDk/lib/python3.8/site-packages/snooker_ball_tracker-0.1.0-py3.8.egg/snooker_ball_tracker/settings.py", line 75, in __getattr__ KeyError: '__path__'

Any idea why this is happening?

Thanks!

After installing package running demo programs complain that libmagic is not present

After installing package running demo programs complain that libmagic is not present

    raise ImportError('failed to find libmagic.  Check your installation')
ImportError: failed to find libmagic.  Check your installation

Fixed by manually installing following packages:

pip install libmagic
pip install python-magic-bin==0.4.14 

Maybe I was doing something wrong but I followed your quick start guide

Selecting "None" on the Detect Color dropdown closes the program

File "/home/ricardo/.local/share/virtualenvs/snooker-ball-tracker-YBvYRYDk/lib/python3.8/site-packages/snooker_ball_tracker-0.1.0-py3.8.egg/snooker_ball_tracker/ball_tracker/settings/colour_detection_settings.py", line 19, in <lambda> File "/home/ricardo/.local/share/virtualenvs/snooker-ball-tracker-YBvYRYDk/lib/python3.8/site-packages/snooker_ball_tracker-0.1.0-py3.8.egg/snooker_ball_tracker/ball_tracker/settings/colour_detection_settings.py", line 136, in update_colour_value KeyError: 'NONE'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.