Repository navigation
perception: keep OCR within the focused window - #44
Closed
charan-rathore wants to merge 1 commit into
Closed
charan-rathore wants to merge 1 commit into
charan-rathore wants to merge 1 commit into
Conversation
Contributor
Author
|
Closing this as superseded. Main now deliberately keeps the menu bar strip in the OCR region for a focused window (see the ocr_region tests in tests/test_ocr_cache.py on main), and this PR removes that strip, so it would work against the current design. Sorry for the noise. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #35.
ocr_regionjoined a low window to the menu bar at the top of the display, then OCRed the entire rectangle between them. On a window over another app, unrelated background text entered the classifier's screen read and made OCR expensive. The crop now stays within the frontmost window plus its existing margin, clamped to the display. With no usable window, it keeps the full-display fallback.This deliberately uses one crop rather than changing the OCR cache to manage two regions. The reporter measured 46.4 seconds for the joined region and 0.33 seconds for the window-only region on their 5K Finder repro. Those are reporter measurements, not a live replay by this PR.
Checks
uv run --no-sync ruff check .: passed.uv run --no-sync ruff format --check .: passed.uv run --no-sync pytest -q: 612 passed, 3 skipped, 1 xfailed on Linux.Caveat
Text visible only in the menu bar that is not available through accessibility will no longer be OCRed. There was no live Finder/OCR replay here; the focused tests use fake captures and a fake OCR reader.
Instinct assisted.