Skip to content

Add image preprocessing pipeline for OCR / template matching#345

Merged
JE-Chen merged 2 commits into
devfrom
feat/preprocess-batch
Jun 22, 2026
Merged

Add image preprocessing pipeline for OCR / template matching#345
JE-Chen merged 2 commits into
devfrom
feat/preprocess-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 22, 2026

Copy link
Copy Markdown
Member

The highest-leverage gap from this round's research: locate_text / ocr_read_structure and match_template fed the raw screen capture to OCR / the matcher — small UI text, dark themes, low contrast and skew wreck both, and there was no preprocessing seam anywhere.

  • preprocess_image (AC_preprocess_image): chain named steps grayscale → upscale → binarize → deskew → denoise → contrast (CLAHE), in order. Returns an ndarray; the executor command writes the cleaned image to output_path so it's usable from JSON / MCP / the builder.
  • Building blocks: to_grayscale, upscale (scale/interp), binarize (otsu / adaptive_mean / adaptive_gaussian), denoise (non-local means), enhance_contrast (CLAHE), deskew + detect_skew_angle (version-robust minAreaRect normalisation, clamped to ±max_angle).
  • Injectable haystack (ndarray/path/PIL) → ndarray, so fully headless-testable on synthetic arrays (incl. a rotated-bar deskew case). Base OpenCV only (CLAHE/fastNlMeans/adaptiveThreshold/warpAffine), lazy imports. Wired through all 5 layers + headless test + EN/Zh docs + WHATS_NEW. Qt-free.

@codacy-production

codacy-production Bot commented Jun 22, 2026

Copy link
Copy Markdown

Not up to standards ⛔

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit 073782f into dev Jun 22, 2026
15 of 16 checks passed
@JE-Chen JE-Chen deleted the feat/preprocess-batch branch June 22, 2026 22:07
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant