Get FRC scores from an image
Project description
FRC Livescore
A package which can determine the score of a live FRC game from an image.
Features
- Access to common parts of the scoreboard (Time, Score, Match Number)
- Easy to use
- Fast
- Template matching (it doesn't matter where the scoreboard is on the screen)
Installation
$ pip install frc-livescore-ng
You will also need to have Tesseract
and OpenCV 3 (instructions for
macOS,
Windows and
Linux)
installed in order for frc-livescore
to work.
Tested with python 3.10.
This fork of andrewda/frc-livescore updates dependencies, uses ORB algorithm for score board detection which is not restricted by licenses. Add support for 2020, 2021 and 2022 games.
Usage
Check out the examples
or tests
directory for full examples on the usage of
frc-livescore-ng
.
A very simple example program would be to just get the score data from a single image. To do this, we'll use OpenCV to read the image.
from livescore import Livescore2022
import cv2
# Initialize a new Livescore instance
frc = Livescore2022()
# Read the image from disk
image = cv2.imread('./tests/images/2022/frame1991.png')
# Get score data
data = frc.read(image)
print(data)
API
Constructor
LivescoreYEAR(debug=False, save_training_data=False, training_data=None)
Currently supported years: 2017, 2018, 2019, 2020, 2021, 2022
e.g. Livescore2017(), Livescore2018() or Livescore2019() or Livescore2020() or Livescore2021() or Livescore2022()
debug
- Debug mode, where outputs are displayed.save_training_data
- Whether the training should be saved to disk.append_training_data
- Whether to start training from scratch
Creates and returns a new Livescore instance with specified options.
Methods
.read(img, force_find_overlay=False)
img
- The image to read from.force_find_overlay
- Whether we should forcefully find the overlay or only do so if the overlay cannot be found.
Reads an image and returns an OngoingMatchDetails class
containing the score data. Values that could not be determined from the input
image will be False
.
Classes
AllianceYEAR
Currently supported years: 2017, 2018, 2019
e.g. Alliance2017, Alliance2018 or Alliance2019
score
- The alliance's score.- ... many more year-specific properties.
Stores year-specific properties for an alliance, such as whether the switch or scale is owned for the 2018 game.
OngoingMatchDetails
match_key
- The match key, such as "qf1m2".match_name
- The match name, such as "Qualifications 16 of 128".mode
- The current game mode, one ofpre_match
,auto
,teleop
, orpost_match
.time
- The time remaining in the match.red
- An Alliance class for the red alliance.blue
- An Alliance class for the blue alliance.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file frc-livescore-ng-0.0.1rc110.tar.gz
.
File metadata
- Download URL: frc-livescore-ng-0.0.1rc110.tar.gz
- Upload date:
- Size: 14.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30e3ac9c47f0917c4273fb970895757958d5747d3f9c43bb4d78e98a2d9cb1b1 |
|
MD5 | 24579a06769b5b74fa2c1cfac9a40c4a |
|
BLAKE2b-256 | 5eba6d17526458a60a0b6e6f0f15654e719a28429fdbe9d4bfd2fa5035119d21 |
File details
Details for the file frc_livescore_ng-0.0.1rc110-py2.py3-none-any.whl
.
File metadata
- Download URL: frc_livescore_ng-0.0.1rc110-py2.py3-none-any.whl
- Upload date:
- Size: 14.8 MB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | db423bf92674d2d65f3d7540063c687ee6f595c4321e4963b46332e58e8369e1 |
|
MD5 | ca60856f893f5c3391ceeb5f07d21a9a |
|
BLAKE2b-256 | 3d90df5c44c809e79fb19d1be52551b5a9194fb7d9544ce083896482a4e9f1ed |