# S4 — geometry evidence, calibration and numeric OCR

2026-09-26. Source code implementation for A5B-027a–030b. Physical testing remains deferred at the user's direction. Seven desk-completable cards (13 points) accepted; 029b (3 points) remains Blocked for physical repeatability. No real camera, surveyed phone position, outdoor match rate or drift result is claimed.

## 027 — inputs and decision policy

`GeometryScorer` policy A5B-GEOMETRY-1 takes a current horizontal position, explicit position uncertainty in metres, camera heading with explicit angular uncertainty, pitch, normal-tracking flag, calibration flag, estimated visible facade fraction and source facade/footprint geometry. Missing, negative, nonfinite or out-of-range evidence abstains. GPS and magnetic heading are diagnostics only; neither silently substitutes for calibrated camera pose.

Local map coordinates approximate east/north metres relative to (-73.913, 40.803), with longitude scale 111320 × cos(40.804°). This is a small pilot-area approximation, not a surveyed CRS transformation. Source geometry remains provisional. Only valid source frontages within 100 m plus position uncertainty are considered. Candidate facade midpoint bearing must be within 30° plus heading uncertainty plus atan2(position uncertainty, distance), with its outward normal facing the observer. Central camera-ray intersections are ordered by distance. A nearer building footprint by more than max(1 m, twice position uncertainty) caps an occluded candidate at 0.35. Parcel-only candidates do not become building occluders. Multiple plausible candidates remain in the list, including tied parcel/building identities.

Score = 0.25 × position quality + 0.25 × angular alignment + 0.20 × facing cosine + 0.20 × visible fraction + 0.10 × central-ray hit. Position quality = max(0, 1 − uncertainty/20); angular quality = max(0, 1 − angular error/(30 + uncertainty spread)). Back-facing/out-of-cone facades score zero. This is a planning heuristic, **not a probability or measured recognition confidence**.

A manual-review suggestion requires score ≥0.80, lead over second candidate ≥0.15, position uncertainty ≤10 m, heading uncertainty ≤15°, |pitch| ≤30°, visibility ≥75%, normal tracking and current calibration. Otherwise ABSTAIN with explicit reasons. All outcomes have automaticSelectionAllowed=false. Suggestions never select a property, request its card or place it. User selection remains explicit even after a suggestion.

`GeometryTests.testReplayReport` runs 12 deterministic synthetic scenes. Clear front and north-angle wrap suggest manual review; opposite-side, shared frontage, uncertain position/heading, missing/low visibility, tracking loss, absent calibration and high pitch abstain. Near/far occlusion keeps both candidates and caps the rear one. Threshold-edge tests also run. These are desk threshold reviews; field precision/recall and parameter tuning are not measured.

## 028 — native scoring and evidence list

The existing API's frontage baselines/normals and Polygon/MultiPolygon footprints decode into native structures. Parcel targets retain optional BIN and null footprint. The native list shows each candidate's score and reason labels without discarding lower-scoring candidates. Camera horizontal direction is projected from ARKit's negative-z viewing axis into local (x, −z), then inverse-transformed into east/north for heading. Scores refresh twice per second with current pose. Visibility is an explicit user estimate, initially unknown. No observer coordinates leave the device. OCR does not enter the scoring function.

## 029 — two-reference setup and deferred restart check

The Calibration & evidence screen accepts two named, independently located **phone positions**, not facade aim points, with latitude/longitude in the pilot area and reference uncertainty 0.1–1 m. Capture first, move safely with the same AR session to a second known position at least 3 m away, then capture second. Use the maximum uncertainty entered at either reference. No fake surveyed coordinates are supplied. Reject duplicate IDs, short baselines, nonfinite values, >10% baseline-length mismatch or >1 m residual. Two-position fitting captures a horizontal rigid map→local rotation and translation, reference IDs, session UUID, residual, position/heading uncertainty and a heuristic setup-quality value. Height and full 3D registration are outside this fit. The values are displayed in the app and remain memory-only; they are not added to the numeric trace.

The fit estimates position uncertainty as reference accuracy plus residual and angular uncertainty as atan2(2 × reference accuracy + residual, map baseline). The scoring caller adds provisional allowances of 2 m plus 0.1 × displacement and 5°; these are planning assumptions, not measured AR error. Calibration expires after 60 seconds or 20 m displacement. Tracking degradation, reset, stop, backgrounding or restart invalidates it and clears OCR hints. The user must recapture two references. Synthetic tests cover rigid transform/inverse, rejected setups, new session invalidation and solving a different local origin after restart.

029a's desk build was decoupled from the deferred 024b physical prerequisite under the user's standing approval to defer physical testing. Tracker preserves originalDependsOn and deferredDependsOn. This does not close 024b or establish field acceptance.

**029b remains Blocked.** Its software path and synthetic restart checks are implemented, but the same two known phone positions must be captured on an actual phone before and after termination/relaunch. Repeat three times; record reference uncertainty, transform, residual, heading uncertainty, independent check-point horizontal error and tracking state. Confirm no previous transform or hints survive restart, backgrounding or loss. Proposed desk gate: ≤1 m fit residual, ≤2 m independent check-point error and ≤5° heading disagreement across repeats; these are proposed acceptance bands, not observations. Failures stay open for review. The empty ledger is `dashboard/public/s4-calibration-template.csv`.

## 030 — one-frame local Vision OCR

Explicit Read one frame retains one current immutable AR pixel buffer for a serial background Vision request, oriented for the portrait-only rear camera. Apple Vision accurate recognition runs locally; language correction is disabled. Only standalone 1–5 digit numbers with an optional A–Z suffix and confidence ≥0.80 are retained. Ranges, full phrases, uncertain substitutions, nonnumeric observations and low-confidence output are discarded. Duplicate numbers keep the best confidence. No image, recognized prose or OCR result is saved or uploaded. Only temporary number/confidence pairs appear. Stop, selection changes and session invalidation clear hints; a generation check rejects an in-flight result after those changes. One request at a time bounds frame retention; the buffer is released after completion even when its result is discarded.

Alias support requires exact equality to the alias's initial street-number token. No range expansion or fuzzy correction. Mismatch/blank/unsupported reading is neutral; geometry, selected ID, card request and placement never change. A high OCR confidence is text confidence, not property identity confidence.

Actual macOS Vision recognition passed on an in-memory synthetic `733` text image and a blank image. Parser/alias tests cover mismatches, range text, low confidence and malformed numbers. This proves local OCR execution and numeric output, not physical camera readability. Physical orientation, privacy disposal, sunlight, small text and real addresses remain in the deferred device check.

## Evidence

- `docs/evidence/S4/core-tests.txt`: 23 passing tests, including S3 regression tests.
- `docs/evidence/S4/replay-results.json`: 12 synthetic scene results emitted by the tested scorer.
- `docs/evidence/S4/simulator-build.txt`: Debug simulator build.
- `docs/evidence/S4/device-build.txt`: unsigned Release iPhone build; not installation or device execution.
- `docs/evidence/S4/ui-review.md`: native simulator and published web review.
- Source: `ios/A5BCore/Sources/A5BCore/{GeometryScoring,Calibration,StreetNumbers}.swift`, native AppModel, ARCameraView, EvidenceScreen and CameraScreen.

Apple API references: https://developer.apple.com/documentation/vision/vnrecognizetextrequest and https://developer.apple.com/documentation/vision/vnimagerequesthandler . No third-party OCR or server image processing is used.
