GithubHelp home page GithubHelp logo

techplexengineer / frc-livescore Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andrewda/frc-livescore

0.0 1.0 0.0 84.79 MB

A Python package to determine the score of an FRC game from images

License: MIT License

Makefile 0.27% Python 99.73%

frc-livescore's Introduction

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.

frc-livescore's People

Contributors

andrewda avatar fangeugene avatar newtonwolfe avatar techplexengineer avatar

Watchers

 avatar

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.