Skip to content

Base image: self-contained Oculix natives + working opt-in OCR text actions - #169

Merged
xywang68 merged 2 commits into
masterfrom
update-readme-ocr
Sep 21, 2026
Merged

xywang68 merged 2 commits into
masterfrom
update-readme-ocr

Conversation

@xywang68

@xywang68 xywang68 commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds an opt-in OCR mode to the frozen findTargetImage CLI seam and makes the base image self-contained with respect to the Oculix native libraries. Existing image-matching consumers are unaffected: with no --ocr* argument the seam follows the original code path and returns the original JSON shape.

Changes

seam/ — the seam is now in-tree (no npm dependency)

  • Removed third_party/xysikulixapi; the seam source, a fetch-oculix.sh that pulls the latest stable Oculix JAR at build time, and a minimal package.json (java-bridge, minimist) live under seam/.
  • New opt-in arguments: --ocrPath, --ocrSimilarity, --ocrMaxSim, --ocrWaitTime, --ocrMaxCount, --ocrAction, --ocrDetail, --ocrPSM, --ocrOEM.
  • OCR matches reuse the existing action set (click, doubleClick, rightClick, hover, hoverClick) and add an optional ocrDetails array. clicked is set only for actions that actually click.

.docker/autobdd-base.dockerfile — natives are baked

  • The bundled Linux x86-64 natives live inside the engine JAR under linux-x86-64/. Extracted deterministically with unzip into /opt/oculix-natives, registered via /etc/ld.so.conf.d/oculix.conf + ldconfig, with LD_LIBRARY_PATH set — so the image needs no runtime extraction and no writable /tmp or /root.

Tests & docs

  • autobdd-base-test gains an OCR section (detection + all five actions); the native-library checks are now meaningful.
  • README documents the OCR interface, the optional ocrDetails field, and the self-contained natives.

Verification

docker build -f .docker/autobdd-base.dockerfile -t xyteam/autobdd-base:test .
cd test-projects/autobdd-base-test
AutoBDD_Ver=test docker compose run --rm autobdd-base-test make base-test
  -> base-test: 50 passed, 0 failed

Known limitation

--ocrDetail=word reports the matched region (tight box when the engine exposes one, otherwise the searched region's rectangle) rather than one entry per token. Per-word boxes need OCR.readWords()/ResultIterator, unconfirmed in this Oculix build; the current path never crashes and is documented as best-effort.

…ve third_party/xysikulixapi dependency; add seam source
…ectations

seam/src/findTargetImage.js:
- Restore the truncated main block (target_result + console.log) so the CLI
  always emits its JSON on stdout.
- OCR mode no longer uses Screen.capture() (which returns no getWidth() in this
  Oculix build and threw an uncaught TypeError, killing the process with no
  output). It OCRs the screen in place via new Region(screen.getBoundsSync()),
  using Region.findText() for a tight box when available and the searched
  region's rectangle otherwise.
- Stop shell-quoting argv values: shell-quote escaped the space in
  "AUTOTEST OCR" to AUTOTEST\ OCR, so OCR text never matched. Drop
  safequote.js, which is now dead code.
- Set 'clicked' only for actions that actually click; 'hover' leaves it null.

.docker/autobdd-base.dockerfile:
- The bundled Linux x86-64 natives live inside the engine JAR under
  linux-x86-64/; the old 'java -jar ... -c' warm-up extracted nothing, so the
  copy glob matched zero files and the image shipped no natives. Extract them
  deterministically with unzip, install them world-readable into
  /opt/oculix-natives, register the directory via /etc/ld.so.conf.d + ldconfig
  and keep LD_LIBRARY_PATH. The image is now self-contained: no runtime
  extraction and no writable /tmp or /root required.

test-projects/autobdd-base-test/base-test/run.sh:
- Re-enable the native-library checks (they pass for real now) and correct five
  OCR expectations that compared jq -r output ('object') against a quoted
  literal ('"object"').

README.md:
- Natives are baked at image-build time, not extracted at runtime.
- --ocrDetail reports the matched region (tight box when available), not one
  entry per word; 'clicked' is documented as clicking-actions-only.

Verified: docker build + 'AutoBDD_Ver=test docker compose run --rm
autobdd-base-test make base-test' -> base-test: 50 passed, 0 failed.
@xywang68 xywang68 changed the title Update README with OCR enhancements and native library handling Base image: self-contained Oculix natives + working opt-in OCR text actions Sep 21, 2026
@xywang68
xywang68 merged commit 8ff5624 into master Sep 21, 2026
1 check passed
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