pupilometer/GEMINI.md
Tempest 1f8da0017c feat: Integrate pupil segmentation infrastructure
This commit introduces the necessary infrastructure for integrating pupil segmentation into the mono camera pipelines.

Key changes include:
- Modifying `gstreamer_pipeline.py` to add a tee element to split mono camera streams, creating a dedicated branch for segmentation output with a placeholder `videoconvert` element and `appsink`. This also includes new callbacks and data structures to handle the segmentation frames.
- Adding a new Flask route `/segmentation_feed/<int:stream_id>` to `app.py` to serve the segmentation video stream to the frontend.
- Updating `index.html` to display the new segmentation feed and implementing cache-busting for all video streams.
- Introducing `test_segmentation.py` to verify the functionality of the new segmentation feed.
- Refine existing UI and visual tests by updating locators and fixing indentation errors to accommodate the new segmentation feature and maintain test stability.
2025-12-11 17:52:08 +07:00

23 lines
2.1 KiB
Markdown

### Pupil Segmentation Integration
- **Objective:** Integrated Pupil segmentation into the mono camera pipelines.
- **Key Changes:**
- Modified `src/unified_web_ui/gstreamer_pipeline.py` to:
- Add a `tee` element for mono camera streams to split the video feed.
- Create a new branch for pupil segmentation with a `videoconvert` placeholder and a dedicated `appsink` (`seg_sink_{i}`).
- Implement `on_new_seg_sample_factory` callback to handle segmentation data.
- Added `seg_frame_buffers` and `seg_buffer_locks` for segmentation output.
- Introduced `get_seg_frame_by_id` to retrieve segmentation frames.
- Ensured unique naming for `tee` elements (`t_{i}`) in the GStreamer pipeline to prevent linking errors.
- Modified `src/unified_web_ui/app.py` to:
- Add a new Flask route `/segmentation_feed/<int:stream_id>` to serve the segmentation video stream.
- Added `datetime.utcnow` to the Jinja2 context for cache-busting in templates.
- Modified `src/unified_web_web_ui/templates/index.html` to:
- Include a new "Segmentation Feed" section displaying the segmentation video streams, sourcing from `/segmentation_feed/` with cache-busting timestamps.
- Updated existing video feeds (`video_feed`) with cache-busting timestamps for consistency.
- **Testing:**
- Created `tests/test_segmentation.py` to verify the segmentation feed is visible and updating.
- Updated `src/unified_web_ui/tests/test_ui.py` to refine locators (`#camera .camera-streams-grid .camera-container-individual`) for camera stream elements, resolving conflicts with segmentation feeds.
- Updated `src/unified_web_ui/tests/test_visual.py` to refine locators (`#camera .camera-mono-row`, `#camera .camera-color-row`, `#camera .camera-mono`) to prevent strict mode violations and ensure accurate targeting of camera layout elements.
- Fixed indentation errors in `src/unified_web_ui/tests/test_visual.py`.
- **Status:** All tests are passing, and the infrastructure for pupil segmentation is in place, awaiting the integration of a DeepStream model.