Skip to main content

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.

Build GitHub license

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 of pre_match, auto, teleop, or post_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

frc-livescore-ng-0.0.1rc106.tar.gz (14.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

frc_livescore_ng-0.0.1rc106-py2.py3-none-any.whl (14.8 MB view details)

Uploaded Python 2Python 3

File details

Details for the file frc-livescore-ng-0.0.1rc106.tar.gz.

File metadata

  • Download URL: frc-livescore-ng-0.0.1rc106.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

Hashes for frc-livescore-ng-0.0.1rc106.tar.gz
Algorithm Hash digest
SHA256 171139414019e4856c889bfacd6c505ce2f67204f5aac668d0fbc4032d648be4
MD5 e66d53b658da2a75fa11b0d64683c0df
BLAKE2b-256 8e6928153e8098f7a5b2140aeed2082b2cd076f49700520ab9f5620175f1ebe0

See more details on using hashes here.

File details

Details for the file frc_livescore_ng-0.0.1rc106-py2.py3-none-any.whl.

File metadata

  • Download URL: frc_livescore_ng-0.0.1rc106-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

Hashes for frc_livescore_ng-0.0.1rc106-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 402581b2248da875035217eae05d65f228bac7fa6147fa55d9b3ed5395835a53
MD5 4b9795b69513b6b7c5e93b5ae6af0f2f
BLAKE2b-256 ff5502f946191afd8751a1e134bb388a463f290c03dc6074d40ac9a4d9ad415d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page