Skip to content

experiments: validate camera metadata for reconstruction - #9

Merged
AidenJohnston merged 1 commit into
mainfrom
codex/capture-contract-probe
Sep 27, 2026
Merged

AidenJohnston merged 1 commit into
mainfrom
codex/capture-contract-probe

Conversation

@huntertcarver

Copy link
Copy Markdown
Collaborator

Camera metadata can look structurally valid while a camera-axis or pose-direction mismatch sends reconstruction rays to the wrong place. This adds an isolated, standard-library experiment that checks the camera/tap subset of measure-lab session format v2 and exports explicit OpenCV camera-to-world metadata.

It preserves tracking state and session coordinates, checks saved tap rays, and covers crop/resize intrinsics. It rejects malformed rotations, nonfinite/overflowing inputs, nonunit directions, off-image taps, duplicate records and incompatible source units. The source contract is pinned to ca89849 from #7; the experiment runs independently with synthetic fixtures and changes no production capture code.

Validation:

  • python3 -m unittest -v: 14 tests passed on Python 3.13.7.
  • CLI converted two synthetic frames and checked two tap rays.
  • Independent review checked 100 rotations and rechecked the malformed-input fixes.
  • git diff --check passed; generated outputs remain gitignored.

This validates metadata arithmetic only. It does not load photos, run a reconstruction model, validate the complete session schema, or establish physical camera accuracy. Field measurements and meter-anchor alignment remain separate work.

@vercel

vercel Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
house-scanning-web Ignored Ignored Preview Sep 26, 2026 4:28am UTC

@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 3db0f8fe-500d-40b7-a479-55fded47ad36

📥 Commits

Reviewing files that changed from the base of the PR and between eb9d480 and 4b6c430.

📒 Files selected for processing (4)
  • experiments/capture-contract/README.md
  • experiments/capture-contract/capture_contract.py
  • experiments/capture-contract/fixtures/synthetic-session.json
  • experiments/capture-contract/test_contract.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the size:L 100-499 effective changed lines. label Sep 26, 2026

@SamGu-NRX SamGu-NRX left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the camera-axis conversion, saved-frame rays, crop/resize intrinsics, and the session-v2 contract against #7 at ca89849. I found no actionable correctness defect in this head. The experiment does not establish device accuracy or reconstruction interoperability, as its PR description notes. This is a draft, so this review is not a readiness recommendation.

@SamGu-NRX

Copy link
Copy Markdown
Owner

@greptileai

@greptile-apps

greptile-apps Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Low risk] Adds isolated experiment for camera metadata validation.

The PR appears safe to merge, though the tap image-boundary check and three previously reported quality issues remain.

Fix All in Claude CodeFindings

  1. P2 Off-image taps pass validation ▶
  2. P2 Tap IDs can collide ▶
  3. P2 Resized intrinsics can overflow ▶
  4. P2 Output writes can destroy results ▶
Fix with agent prompt
### Issue 1
experiments/capture-contract/capture_contract.py:93
A tap at `u == width` or `v == height` passes this check, even though those coordinates lie beyond the last pixel of the saved image. If its saved ray matches the computed ray, the probe reports the off-image tap as valid, making the tap check misleading. Use an exclusive upper bound.

```suggestion
    if not (0 <= u < width and 0 <= v < height):
```

### Issue 2
experiments/capture-contract/capture_contract.py:undefined-151
Two taps with the same ID both pass validation and produce `tap_checks` entries that cannot be distinguished by ID. Missing IDs have the same problem. Reject duplicate and missing tap IDs so each reported check can be matched to its source tap.

### Issue 3
experiments/capture-contract/capture_contract.py:undefined-117
The inputs are checked for finiteness, but the computed values are not. For example, `fx=1e200` and `sx=1e200` return an infinite focal length, so a caller can receive an invalid camera matrix without an error. Check the computed values before returning them.

```suggestion
    return list(vector([fx*sx, fy*sy, (cx-x0)*sx, (cy-y0)*sy],
                       4, "resized intrinsics"))
```

### Issue 4
experiments/capture-contract/capture_contract.py:undefined-208
Writing directly to `--out` truncates an existing conversion before the new one is complete. If the write is interrupted or the disk fills, the previous result is lost and a partial JSON file remains. Write a temporary file and replace the destination after the write succeeds.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Summary

The PR adds an isolated camera-metadata probe that converts measure-lab v2 poses to OpenCV camera-to-world matrices and checks saved tap rays.

  • Includes synthetic fixtures and tests for coordinate conversion, intrinsics, and malformed inputs.
  • Does not change production capture or establish physical camera accuracy.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Session JSON] --> B[Validate frames and taps]
  B --> C[Convert camera basis]
  C --> D[Output metadata and tap checks]
Loading

Reviews (2) · Last reviewed commit: "experiments: validate camera metadata fo..."

Comment thread experiments/capture-contract/capture_contract.py
Comment thread experiments/capture-contract/capture_contract.py
Comment thread experiments/capture-contract/capture_contract.py
@AidenJohnston
AidenJohnston marked this pull request as ready for review September 27, 2026 15:27
@AidenJohnston
AidenJohnston merged commit a511296 into main Sep 27, 2026
5 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@codemetrics-ai

Copy link
Copy Markdown

Note

Review skipped

Codemetrics is installed on this repository, but it hasn't been added to your team yet.

To enable AI code reviews for this repo, go to your dashboard and add house-scanning-master to your team's repositories.

Comment thread experiments/capture-contract/capture_contract.py
SamGu-NRX pushed a commit that referenced this pull request Oct 15, 2026
* Sync c2-volumetric breadth work from the Project store (result file C2-volumetric.md)

* Sync c2-volumetric breadth work from the Project store (result file C2-volumetric.md)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 effective changed lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants