How gmkrxb/xiaoyuankousuan works
Main Components
• Main Application (main.py): This is the entry point where the GUI is launched, input parameters (e.g., number of questions, timing, regions for capturing numbers) are set, and the overall control flow is coordinated.
• OCR Engine Integration: The system integrates with Tesseract OCR (and has a module for comparison with easyocr). This part is responsible for processing the captured image and returning recognized digits.
• Coordinate Capture Module (get_xy.py): A utility component to obtain mouse coordinates, which are used to define regions from which screenshots will be taken.
• Comparison Module (comparison.py): A helper script to test and compare recognition results and performance between different OCR libraries.
• Assets and Temporary Storage: The static image (bg.png) used for background filling in the GUI, and the "temp" folder which stores the images captured or segmented during processing.
• Test Resource (test_photo.png): Used for testing and validating OCR performance.
Relationships and Data Flow
• The “main.py” serves as the central coordinator. When the user initiates the process, it triggers:
• The coordinate capture module (get_xy.py) to obtain regions from the screen.
• The OCR pipeline where Tesseract (or easyocr, as tested via comparison.py) takes the screenshot (optionally from the "temp" directory) and runs recognition.
• The assets (bg.png and possibly temporary images in the "temp" folder) are used by the GUI rendering part of the application.
Architectural Patterns and Key Points
• Modular Design: The application is separated into distinct files each managing specific tasks (main application logic, OCR comparison/benchmarking, and coordinate capture).
• Environment Configuration: Although not a runtime component, the installation instructions for Tesseract and library dependencies can be noted as “external dependencies” that need to be configured for the system to work properly.
Additional Details
• Mention that the “temp” folder is a runtime-generated asset where image segmentation results are stored, reinforcing that the system dynamically creates and utilizes temporary data.