From 85747f573403e2089dd9dd677650f6338ea7e56e Mon Sep 17 00:00:00 2001 From: spacedandy-agents-simplex <342056592+spacedandy-agents-simplex@users.noreply.github.com> Date: Thu, 15 Oct 2026 09:18:58 +0000 Subject: [PATCH] ci: let tesseract binarise the normalised OCR image In run 38711351160 the normalised image had no rings and showed the button labels, grey and dark text all dark on white, but the fixed 80% threshold turned every pixel with over 20% contrast black, so letters merged into blobs ("Be free" read as "Be tires"). With the background now uniformly white, tesseract's own threshold separates the text, so the image goes to it in grayscale. --- scripts/ci/desktop-linux/ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/desktop-linux/ui b/scripts/ci/desktop-linux/ui index 2d09da8563..c83aac7daf 100755 --- a/scripts/ci/desktop-linux/ui +++ b/scripts/ci/desktop-linux/ui @@ -92,7 +92,7 @@ ocr() { convert "$png" -colorspace Gray "$o/gray.png" convert "$o/gray.png" \( +clone -morphology Dilate Rectangle:9x1 -morphology Dilate Rectangle:1x9 -morphology Erode Rectangle:9x1 -morphology Erode Rectangle:1x9 \) -compose Difference -composite "$o/dark.png" convert "$o/gray.png" \( +clone -morphology Erode Rectangle:9x1 -morphology Erode Rectangle:1x9 -morphology Dilate Rectangle:9x1 -morphology Dilate Rectangle:1x9 \) -compose Difference -composite "$o/light.png" - convert "$o/dark.png" "$o/light.png" -compose Lighten -composite -negate -resize 200% -threshold 80% "$o/text.png" + convert "$o/dark.png" "$o/light.png" -compose Lighten -composite -negate -resize 200% "$o/text.png" tesseract "$o/text.png" "$o/text" --psm 11 tsv > /dev/null 2>&1 python3 "$here/screen-text.py" 2 "$@" "$o/text.tsv" }