#Read Module
File: read.py · Lines: 103
#Overview
The read.py module provides OCR-based team selection detection for FC24 only. FC25 and Undisputed have their own inline OCR implementations.
FC24 ONLY This module is only used by
fc24.py. FC25 and Undisputed bots do NOT import or use this module.
#Functions
#detect_team_selection(frame) ACTIVE
Detect whether the team selection screen is showing and read the team name.
| Parameter | Type | Description |
|---|---|---|
frame |
np.ndarray |
Screenshot as numpy array |
Returns: (position, text) tuple
| Return Value | Meaning |
|---|---|
(0, "Team Name") |
Home selection detected |
(1, "Team Name") |
Away selection detected |
(-1, text) |
No selection detected |
Detection Logic:
- Check white pixel density at
(300, 650)region — if >9990 white pixels → Home side - Check white pixel density at
(1115, 650)region — if >9990 white pixels → Away side - OCR read team name from nearby region
#screen_to_np() INTERNAL
Capture screenshot and convert to numpy array.
#read_team_selection() DEPRECATED
Convenience wrapper for detect_team_selection(). Not called anywhere in production code.
#read_home_selection() ACTIVE
Read home team name from screen if home selection is showing.
Returns: Team name string or None
#read_away_selection() ACTIVE
Read away team name from screen if away selection is showing.
Returns: Team name string or None
#OCR Configuration
pytesseract.pytesseract.tesseract_cmd = os.getenv('TESSERACT_PATH', 'tesseract')OCR settings used: --psm 7 (single text line mode)
#Text Corrections
All OCR functions apply these corrections:
|→I(pipe to letter I)0→O(zero to letter O)- Remove all non-alphanumeric characters except spaces and dots