Skip to content

Commit

Permalink
replaced pyzbar with cv2 because it's just better
Browse files Browse the repository at this point in the history
  • Loading branch information
AJaiman committed Mar 2, 2024
1 parent da0c607 commit bc3af3d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 33 deletions.
9 changes: 5 additions & 4 deletions falconscoutcore/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
)

Expand Down
30 changes: 1 addition & 29 deletions falconscoutcore/data/2024vaash_match_data.json
Original file line number Diff line number Diff line change
@@ -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": ""
}
]
[]

0 comments on commit bc3af3d

Please sign in to comment.