From bc3af3d7e748f54373964c9df5a2a16c2116367e Mon Sep 17 00:00:00 2001 From: AJaiman Date: Fri, 1 Mar 2024 23:37:51 -0500 Subject: [PATCH] replaced pyzbar with cv2 because it's just better --- falconscoutcore/app.py | 9 +++--- .../data/2024vaash_match_data.json | 30 +------------------ 2 files changed, 6 insertions(+), 33 deletions(-) diff --git a/falconscoutcore/app.py b/falconscoutcore/app.py index a4ed8fe..0076033 100644 --- a/falconscoutcore/app.py +++ b/falconscoutcore/app.py @@ -11,7 +11,6 @@ import streamlit as st from dotenv import load_dotenv from github import Github -from pyzbar.pyzbar import decode from streamlit.components.v1 import html # Hacky solution to work around Streamlit raising an error about "no event loop" - breaks PEP8 @@ -163,12 +162,14 @@ def scan_qrcode(qr_code_col) -> None: bytes_data = image.getvalue() cv2_img = cv2.imdecode(np.frombuffer(bytes_data, np.uint8), cv2.IMREAD_COLOR) gray_img = cv2.cvtColor(cv2_img, 0) - qr_codes = decode(gray_img) + + decoder = cv2.QRCodeDetector() + data, *_ = decoder.detectAndDecode(gray_img) # Process data and write it to the scouting data file. - if qr_codes: + if data: _process_data( - *[qr_code.data.decode("utf-8") for qr_code in qr_codes], + data, status_message_col=qr_code_col, ) diff --git a/falconscoutcore/data/2024vaash_match_data.json b/falconscoutcore/data/2024vaash_match_data.json index e5133fa..0637a08 100644 --- a/falconscoutcore/data/2024vaash_match_data.json +++ b/falconscoutcore/data/2024vaash_match_data.json @@ -1,29 +1 @@ -[ - { - "ScoutId": "shayaan", - "MatchKey": "qm1", - "Alliance": "red", - "DriverStation": 1, - "TeamNumber": 3467, - "AutoSpeaker": 3, - "AutoAmp": 0, - "AutoLeave": true, - "AutoCenterline": true, - "AutoNotes": "", - "TeleopSpeaker": 7, - "TeleopAmp": 0, - "TeleopTrap": 0, - "TeleopNotes": "", - "Parked": false, - "ClimbStatus": true, - "Harmonized": false, - "ClimbSpeed": "Fast", - "EndgameNotes": "", - "Disabled": false, - "DriverRating": "Fluid", - "DefenseTime": "Never", - "DefenseSkill": "", - "CounterDefenseSkill": "Good", - "RatingNotes": "" - } -] +[] \ No newline at end of file