Skip to content

feat(viewer): colour cameras by in_view coverage and draw seeing rays - #105

Open
dchaudhari7177 wants to merge 1 commit into
bamdadd:mainfrom
dchaudhari7177:feat/viewer-coverage-colours
Open

feat(viewer): colour cameras by in_view coverage and draw seeing rays#105
dchaudhari7177 wants to merge 1 commit into
bamdadd:mainfrom
dchaudhari7177:feat/viewer-coverage-colours

Conversation

@dchaudhari7177

Copy link
Copy Markdown
Contributor

Closes #89.

What

The 3D viewer drew every camera the same crimson, so coverage — which camera holds the object on a given frame, and where two cameras overlap — was invisible in the rendered figure.

  • Each camera's centre, label and frustum is coloured by whether it sees the object on the selected frame: green = sees, grey = blind.
  • A light dotted ray runs from every seeing camera to the point it sees, so 2-camera overlap reads directly off the figure.
  • Legend proxies for the two colours, plus an n/m cameras see the object count in the title.
  • New --frame flag selects the frame (defaults to the manifest's first). An out-of-range value is rejected with the available range named.

Coverage comes from the new _coverage_at_frame helper, which reads the manifest's per-camera in_view flags directly — the viewer does no reprojection of its own, per the acceptance criteria.

Acceptance check on handoff_ltr

frames: 0 .. 39 (40 total)
  frame   0: LEFT=GREEN, MID_RIGHT=grey , RIGHT=grey , WIDE=GREEN
  frame  13: LEFT=GREEN, MID_RIGHT=GREEN, RIGHT=grey , WIDE=GREEN
  frame  20: LEFT=grey , MID_RIGHT=GREEN, RIGHT=grey , WIDE=GREEN
  frame  39: LEFT=grey , MID_RIGHT=grey , RIGHT=GREEN, WIDE=GREEN

LEFT green early and grey late, RIGHT the reverse, WIDE green throughout, with a LEFT/MID_RIGHT overlap band in between — matching the pattern tests/test_handoff_ltr.py documents.

Tests

tests/test_view_scene_3d.py (new, 7 tests) pins: frame enumeration, WIDE seeing every frame, the LEFT/RIGHT swap across the handoff, an overlap frame with both right-hand cameras, rays carrying the point they see, a PNG actually being written, and — most importantly — that reported coverage equals the manifest's in_view set exactly, which is what stops a future reprojection creeping in.

All 7 fail on main with the production file reverted, and pass with it.

Checks run locally

gate result
ruff check . pass
ruff format --check . pass
mypy src pass (no issues, 39 files)
pytest 241 passed, 3 skipped

Two notes on the local run, both environment-side and unrelated to this change:

  • Five test modules (test_dsl_breadth, test_dsl_scene, test_mtmc, test_rig_heights, test_smoke) import multicam_occlusion, which isn't in this repo, so I ignored them locally. CI's business, not this PR's.
  • test_overlay.py::test_importing_package_does_not_import_pillow fails on pristine main on my machine once Pillow is installed (I installed matplotlib to exercise render, and it pulls Pillow in). It asserts "PIL" not in sys.modules globally, so it's order-dependent on whether anything earlier in the session imported PIL — it passes in isolation. Pre-existing, flagged in case it's news.

The 3D viewer drew every camera the same crimson, so a scene's coverage —
which camera holds the object on a given frame, and where two cameras overlap
— was invisible in the rendered figure.

Colour each camera's centre, label and frustum by whether it sees the object
on the selected frame (green = sees, grey = blind), draw a light dotted ray
from every seeing camera to the point it sees so overlap reads directly, and
add a legend plus an "n/m cameras see the object" count to the title.

Coverage is read straight off the manifest's per-camera `in_view` flags via
the new `_coverage_at_frame` helper; the viewer does no reprojection of its
own. A new `--frame` flag chooses the frame and rejects one that is not in the
manifest, naming the available range.

On `handoff_ltr` this reproduces the coverage pattern its test documents:
LEFT green at frame 0 and grey by 39, RIGHT the reverse, WIDE green
throughout, and a LEFT/MID_RIGHT overlap band in between.
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.

3D viewer: colour cameras by in_view coverage + shade overlap

1 participant