Conversation
…mographies docstr Add end-to-end mapping tests and related fixtures, plus small API/docs and implementation tweaks. - Tests: add tests/test_mapping.py to exercise marker/contour detection, plotting, overlaying, homography computation, and applying homographies to gaze/fixations for both native and cloud sample datasets. - Fixtures: add mapping_dataset_native and mapping_dataset_cloud fixtures in tests/conftest.py. - API/impl: rename internal helper _overlay_marker_detections_on_frame -> _overlay_detections_on_frame and update label handling so IDs are only rendered when show_ids is True and a marker id is present; update caller site in overlay_detections. - Docs: add pyneon.plot_marker_layout to reference docs and adjust homography docstring/example formatting (brace escaping/fixed indentation). These changes add test coverage for the mapping workflow and make the detection overlay code more robust when marker IDs are absent.
Refactor homography computation to use vectorized arrays: remove per-row _reshape_corners, compute marker corner arrays from center/size via NumPy, build surface_pts_lookup with itertuples, and iterate detections using grouped DataFrame frames (handling MultiIndex). Also add explicit corner column extraction and validation. In visualization, make overlay functions robust to unreadable frames by substituting a gray frame (128) instead of raising errors. Misc: small pyproject formatting tweak, update surface_mapping notebook, and rename/update related tests.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a crash when overlaying contour detections on videos (contour detections don’t have a "marker id"), improves the find_homographies docstring rendering by escaping literal braces in examples, and expands mapping-related tests and docs.
Changes:
- Make video detection overlay robust to contour detections lacking
"marker id"(and add gray-frame fallbacks when frames can’t be read). - Improve
find_homographiesimplementation (more vectorized) and docstring rendering. - Add mapping datasets fixtures + new mapping tests; update Sphinx reference docs to include mapping helpers.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
pyneon/vis/video.py |
Fixes contour overlay crash; adds gray-frame fallback when frame reads fail. |
pyneon/video/homography.py |
Escapes braces in docstring examples and refactors homography computation loop. |
tests/test_video.py |
Updates expectations around unreadable frame 0 (warn + None). |
tests/test_video_mapping.py |
Adds end-to-end tests for plotting/overlay + homography mapping for markers and contours. |
tests/conftest.py |
Adds sample-data fixtures for mapping datasets (native/cloud). |
source/reference/video.rst |
Updates reference page and documents plot_marker_layout. |
.github/workflows/main.yml |
Changes CI trigger behavior for pushes (now only main). |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
I encountered a bug when using
video.overlay_detectionsto overlay a contour detecction:Apparently this is because there is no "marker id" in a contour detection (only "contour name").
Besides, the documentation for
find_homographiesis not rendering the docstring templates {marker_layout_table} and {homographies} because of the {} in the examples. This is fixed by escaping literal braces.I also added
pyneon.plot_marker_layoutto the documentation.