OCCRA
Go to Post I would like to complain about the game as well. Complain, complain. - Monochron [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 07-08-2017, 12:45 PM
andrewda's Avatar
andrewda andrewda is offline
Registered User
AKA: Andrew Dassonville
FRC #2521 (SERT)
Team Role: Programmer
 
Join Date: Oct 2016
Rookie Year: 2016
Location: Oregon
Posts: 6
andrewda is just really niceandrewda is just really niceandrewda is just really niceandrewda is just really nice
Introducing frc-livescore a Python package for processing livestreams

GitHub: https://github.com/andrewda/frc-livescore


FRC Live Replay was just one of the many awesome new tools released by the community last year that involved parsing live FRC streams to get fast data.

Anyone who has worked with the FIRST API knows that it can be pretty slow, taking several minutes to publish scores after the completion of the match. The live streams, though, almost always have only a few seconds of delay, meaning we can get results from them much faster than we can the official API. With many advancements in OCR (optical character recognition) software, we can now process the text within images quickly and with a very high degree of accuracy.

After that brief little intro to the problem, here's the solution: frc-livescore. This Python package uses OpenCV and Tesseract to take a frame from an FRC stream and return the current match string, red/blue scores, and time remaining (more to come in the near future would love help from contributors!). What's more, it's fully customizable, meaning that if a stream uses a different format for their scoreboard (and maybe nicer, *cough* Chezy Champs *cough*), you can quickly create a template for the different important areas and use those instead. This package will allow the creation of many more real-time apps that would not have been possible before with large wait times for the FIRST API. Go ahead, make something awesome!

P.S. I would love more contributors/collaborators on this project! <3

Example Programs:
Reply With Quote
  #2   Spotlight this post!  
Unread 07-08-2017, 04:34 PM
AllenGregoryIV's Avatar
AllenGregoryIV AllenGregoryIV is online now
Engineering Coach
AKA: Allen "JAG" Gregory
FRC #3847 (Spectrum)
Team Role: Coach
 
Join Date: Jul 2008
Rookie Year: 2003
Location: Texas
Posts: 2,753
AllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond repute
Send a message via AIM to AllenGregoryIV
Re: Introducing frc-livescore a Python package for processing livestreams

This is pretty great. I could see this being very useful for off-season events.

Potential ideas
- Score screens in the driver stations that just show the two current scores and time remaining.
- auto clipping and labeling matches in an x-split plugin (I would love for this to exist)
__________________

Team 647 | Cyber Wolf Corps | Alumni | 2003-2006 | Shoemaker HS
Team 2587 | DiscoBots | Mentor | 2008-2011 | Rice University / Houston Food Bank
Team 3847 | Spectrum | Coach | 2012-20... | St Agnes Academy
LRI | Alamo Regional | 2014-20...
"Competition has been shown to be useful up to a certain point and no further, but cooperation, which is the thing we must strive for today, begins where competition leaves off." - Franklin D. Roosevelt
Reply With Quote
  #3   Spotlight this post!  
Unread 07-08-2017, 05:02 PM
tjf tjf is online now
Registered User
AKA: Tim Flynn
FRC #1257 (Parallel Universe), #1228 (RoboTribe)
Team Role: Mentor
 
Join Date: Jun 2016
Rookie Year: 2012
Location: New Jersey
Posts: 301
tjf has a reputation beyond reputetjf has a reputation beyond reputetjf has a reputation beyond reputetjf has a reputation beyond reputetjf has a reputation beyond reputetjf has a reputation beyond reputetjf has a reputation beyond reputetjf has a reputation beyond reputetjf has a reputation beyond reputetjf has a reputation beyond reputetjf has a reputation beyond repute
Re: Introducing frc-livescore a Python package for processing livestreams

Quote:
Originally Posted by AllenGregoryIV View Post
- auto clipping and labeling matches in an x-split plugin (I would love for this to exist)
Well, if it's actually readind the match data from a livestream, just get the current time since start, and use it to create starts and stops, and then you could run it through ffmpeg to extract only the start of a match and the end (plus or minus like 5 seconds I suppose.)

I'm looking at it like a programmer, but this overall is awesome!
__________________

1257 (2016) - Student
1257 (2017-Present) - Overactive Alumn | 1228 (2017-Present) - I do stuff
KD2KRT
My ideas and comments are my own, bla bla bla. If I say anything blatantly wrong, please do me the favor of correcting me. Learning is one thing I'd rather like to keep doing.
Reply With Quote
  #4   Spotlight this post!  
Unread 07-08-2017, 08:36 PM
ollien ollien is offline
Registered User
FRC #5202
Team Role: Alumni
 
Join Date: Feb 2015
Rookie Year: 2015
Location: United States
Posts: 494
ollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to behold
Re: Introducing frc-livescore a Python package for processing livestreams

Quote:
Originally Posted by AllenGregoryIV View Post
This is pretty great. I could see this being very useful for off-season events.

Potential ideas
- Score screens in the driver stations that just show the two current scores and time remaining.
- auto clipping and labeling matches in an x-split plugin (I would love for this to exist)
Score screens in the DS wouldn't work. Unless I'm mistaken, driver stations don't have access to the internet during a match, and even if they did, there would be a huge lag. Also, this would probably blow out your bandwidth limit.
Reply With Quote
  #5   Spotlight this post!  
Unread 07-08-2017, 09:59 PM
Hitchhiker 42's Avatar
Hitchhiker 42 Hitchhiker 42 is offline
Roboter
AKA: Mark Lavrentyev
FRC #4557 (FullMetal Falcons)
Team Role: Programmer
 
Join Date: Oct 2015
Rookie Year: 2015
Location: Connecticut
Posts: 771
Hitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond reputeHitchhiker 42 has a reputation beyond repute
Re: Introducing frc-livescore a Python package for processing livestreams

Quote:
Originally Posted by ollien View Post
Score screens in the DS wouldn't work. Unless I'm mistaken, driver stations don't have access to the internet during a match, and even if they did, there would be a huge lag. Also, this would probably blow out your bandwidth limit.
Not to mention it'd be easier for the field to simply provide access to scores the way they do with time and alliance and position and y'know.
__________________
Don't forget your towel!

Reply With Quote
  #6   Spotlight this post!  
Unread 07-08-2017, 11:08 PM
AllenGregoryIV's Avatar
AllenGregoryIV AllenGregoryIV is online now
Engineering Coach
AKA: Allen "JAG" Gregory
FRC #3847 (Spectrum)
Team Role: Coach
 
Join Date: Jul 2008
Rookie Year: 2003
Location: Texas
Posts: 2,753
AllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond repute
Send a message via AIM to AllenGregoryIV
Re: Introducing frc-livescore a Python package for processing livestreams

Quote:
Originally Posted by ollien View Post
Score screens in the DS wouldn't work. Unless I'm mistaken, driver stations don't have access to the internet during a match, and even if they did, there would be a huge lag. Also, this would probably blow out your bandwidth limit.
I mean for events to be able to set up screens to be used by teams. Not for teams to have their own.
__________________

Team 647 | Cyber Wolf Corps | Alumni | 2003-2006 | Shoemaker HS
Team 2587 | DiscoBots | Mentor | 2008-2011 | Rice University / Houston Food Bank
Team 3847 | Spectrum | Coach | 2012-20... | St Agnes Academy
LRI | Alamo Regional | 2014-20...
"Competition has been shown to be useful up to a certain point and no further, but cooperation, which is the thing we must strive for today, begins where competition leaves off." - Franklin D. Roosevelt
Reply With Quote
  #7   Spotlight this post!  
Unread 07-09-2017, 02:02 AM
ollien ollien is offline
Registered User
FRC #5202
Team Role: Alumni
 
Join Date: Feb 2015
Rookie Year: 2015
Location: United States
Posts: 494
ollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to behold
Re: Introducing frc-livescore a Python package for processing livestreams

Quote:
Originally Posted by AllenGregoryIV View Post
I mean for events to be able to set up screens to be used by teams. Not for teams to have their own.
Got it. Thanks for clearing that up.
Reply With Quote
  #8   Spotlight this post!  
Unread 07-11-2017, 12:37 AM
Praj's Avatar
Praj Praj is offline
Registered User
FRC #6325 (Reset Robotics)
Team Role: Programmer
 
Join Date: Feb 2017
Rookie Year: 2017
Location: Alpharetta
Posts: 115
Praj is a jewel in the roughPraj is a jewel in the roughPraj is a jewel in the rough
Re: Introducing frc-livescore a Python package for processing livestreams

This looks really neat. I am looking into parsing rotors/balls/climbs scored and maybe teams on both alliances as well. I am wondering if maybe if the OCR can be used to read how many exact gears are on an airship for semi-automatic scouting (however this might be too inconsistent).
__________________



2017-Rookie All Star/Rookie Inspiration/Highest Rookie Seed. PCH District Championship Rookie All Star
Reply With Quote
  #9   Spotlight this post!  
Unread 07-11-2017, 12:37 PM
ngreen ngreen is offline
Registered User
AKA: Nelson Green
FRC #1108 (Panther Robotics)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Paola, KS
Posts: 883
ngreen has a brilliant futurengreen has a brilliant futurengreen has a brilliant futurengreen has a brilliant futurengreen has a brilliant futurengreen has a brilliant futurengreen has a brilliant futurengreen has a brilliant futurengreen has a brilliant futurengreen has a brilliant futurengreen has a brilliant future
Re: Introducing frc-livescore a Python package for processing livestreams

Quote:
Originally Posted by Praj View Post
This looks really neat. I am looking into parsing rotors/balls/climbs scored and maybe teams on both alliances as well. I am wondering if maybe if the OCR can be used to read how many exact gears are on an airship for semi-automatic scouting (however this might be too inconsistent).
I don't think exact gears are possible, but interpolations from rotors would be. You could from the times and rotors derive a gear scoring rate. There would be some problems still because of the unequal tiers. The first rotor rate wouldn't be reliable because it doesn't take multiple gears and is automatic. The fourth rate wouldn't always happen. So you might need to take some average of the 2nd and 3rd rotor rates. You also then have to deconvolute this to make it a team-based rather than an alliance-based rate.

I'd researched ocr'ing the stream (for gear rates), so I'm glad someone has at least done it for the score. I'd found this example: https://waldo.jaquith.org/blog/2011/02/ocr-video/, but didn't get very far. I basically reached the part before the Tesseract part, but I wasn't processing the stream in a systematic way. I hadn't yet figured how to start/stop the match time. The background color changes throughout the match and at key times, so that was where I was thinking I could key onto (like the color change at 30 seconds remaining).

Last edited by ngreen : 07-11-2017 at 12:45 PM.
Reply With Quote
  #10   Spotlight this post!  
Unread 07-14-2017, 01:26 PM
andrewda's Avatar
andrewda andrewda is offline
Registered User
AKA: Andrew Dassonville
FRC #2521 (SERT)
Team Role: Programmer
 
Join Date: Oct 2016
Rookie Year: 2016
Location: Oregon
Posts: 6
andrewda is just really niceandrewda is just really niceandrewda is just really niceandrewda is just really nice
Re: Introducing frc-livescore a Python package for processing livestreams

It's now spamming twitter at @FRClivescore. Please report any incorrect scores if possible! It seems like it's most inaccurate with the blue score at the moment, occasionally appending a number at the end.
Reply With Quote
  #11   Spotlight this post!  
Unread 07-14-2017, 01:37 PM
andrewda's Avatar
andrewda andrewda is offline
Registered User
AKA: Andrew Dassonville
FRC #2521 (SERT)
Team Role: Programmer
 
Join Date: Oct 2016
Rookie Year: 2016
Location: Oregon
Posts: 6
andrewda is just really niceandrewda is just really niceandrewda is just really niceandrewda is just really nice
Re: Introducing frc-livescore a Python package for processing livestreams

Just kidding... I'll set it up on a Raspberry Pi tonight and get it up and running on Twitter for tomorrow.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 07:41 PM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi