Files
genshin-assistant/docs/scanner-rework-status.md
T
2026-07-05 21:57:23 +02:00

2.6 KiB

Scanner rework status

Progress on the approved scanner/OCR rework. See ADR-007/008/009 in DECISIONS.md for the decisions behind these.

Done (implemented, unit-tested, build green)

  • OCR eval harnesssrc/eval/, npm run eval, gate in npm test. See ocr-eval.md.
  • C# input/capture sidecarnative/input-helper/, npm run helper:build. Replaces the PowerShell helper on the same JSON protocol; PowerShell remains a fallback. Verified end-to-end (spawn, runtime, base64 capture).
  • Layout profiles + OCR preprocessingsrc/lib/layoutProfile.ts (pure geometry, 16:9 detection), src/lib/ocrPreprocess.ts (grayscale + Otsu binarize). main.ts crops via the profile and OCRs an upscaled + binarized copy.
  • Card-ready gatingsrc/lib/cardReadyGate.ts replaces the fixed 280 ms settle with change+stability polling; robust to animation.
  • GOOD interopsrc/lib/goodInterop.ts (export + best-effort import for scanned records).
  • Rescan-mergesrc/lib/artifactMerge.ts collapses leveled re-scan duplicates by a level-independent identity.
  • Data staleness warningsrc/lib/dataPackageStatus.ts, surfaced in the Scanner Diagnose data-package line.
  • Lock detection (experimental)src/lib/lockDetection.ts, pure heuristic, not yet wired into capture.

Remaining — needs the live environment or a UI pass

These cannot be finished/validated without Genshin running at the user's resolution or without UI work best tested live:

  1. Calibrate IK-style fixed crop coordinates (ADR-009). The layout module is the structure; the exact per-field fractions still come from a colour-detected/fallback detail rect. A reference 16:9 screenshot of the artifact screen lets us pin exact client-relative crop coordinates.
  2. Validate/tune OCR preprocessing on real captures — confirm invert + threshold + upscale factor help (not hurt) actual Tesseract reads. The text-level eval harness cannot measure image preprocessing.
  3. Wire GOOD import — file-picker IPC + merge imported records into the store (the conversion engine is done and tested).
  4. Wire live lock detection — calibrate crop position/threshold against a reference screenshot, then populate a locked flag during capture.

Grow the eval corpus

Every low-confidence review sample already stores its crops + OCR. Confirm/correct those via reviewSampleToEvalCase and commit them into src/eval/corpus/ so the harness keeps measuring real-world accuracy across patches. See ocr-eval.md.