andrewda / frc-livescore

A Python package to determine the score of an FRC game from images
MIT License
29 stars 4 forks source link

FRC Livescore

A package which can determine the score of a live FRC game from an image.

Travis License Version Downloads

Features

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.

Usage

Check out the examples 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 Livescore2018
import cv2

# Initialize a new Livescore instance
frc = Livescore2018()

# Read the image from disk
image = cv2.imread('./examples/scenes/scene1.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

e.g. Livescore2017(), Livescore2018() or Livescore2019()

Creates and returns a new Livescore instance with specified options.

Methods

.read(img, force_find_overlay=False)

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

Stores year-specific properties for an alliance, such as whether the switch or scale is owned for the 2018 game.

OngoingMatchDetails