fix: correct center-point calculation in OCR results

This commit is contained in:
Showdown76 2025-05-19 20:35:11 +02:00
parent 7f5296b2ef
commit 36cfeffe9c

View File

@ -45,10 +45,11 @@ def perform_ocr(screenshot: bytes) -> list[dict]:
for i in range(n):
text = data['text'][i]
if text and text.strip():
# Fix the center-point calculation (add first, then divide)
results.append({
'text': text,
'x': data['width'][i] + data['left'][i] // 2, # center x position
'y': data['height'][i] + data['top'][i] // 2 # center y position
'x': data['left'][i] + data['width'][i] // 2,
'y': data['top'][i] + data['height'][i] // 2
})
# check if debug is enabled