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
  • Super fast
  • Template matching (it doesn't matter where the scoreboard is on the screen)

Installation

$ pip install livescore

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.

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.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.1rc105.tar.gz (14.7 MB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: frc-livescore-ng-0.0.1rc105.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.1rc105.tar.gz
Algorithm Hash digest
SHA256 baf137adaa2a146b021ca2f6bf7bd875cf366126e1065d747c0de680be37fd62
MD5 6c162c85b80cae849362bc4f36deb07e
BLAKE2b-256 5ce1cbb8aeed6aab7e22131ce7ea60b6c36f67631c782aaafe2b677c88806428

See more details on using hashes here.

File details

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

File metadata

  • Download URL: frc_livescore_ng-0.0.1rc105-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.1rc105-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1e47ef28746cde2b37f3a3d46542379c10364d9981eaa3ac0da698a2f449a206
MD5 31910cec2172ee15be5456c88fe8f0e6
BLAKE2b-256 7fd37c01acf2e3b5f89172a65fd25e2edf9ed9ad268408cfe6fa3006b9de1a62

See more details on using hashes here.

Supported by

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