Skip to content

Add skeleton rendering and GUI integration#60

Draft
C-Achard wants to merge 2 commits intocy/camera-loader-fixesfrom
cy/skeleton-display
Draft

Add skeleton rendering and GUI integration#60
C-Achard wants to merge 2 commits intocy/camera-loader-fixesfrom
cy/skeleton-display

Conversation

@C-Achard
Copy link

@C-Achard C-Achard commented Mar 4, 2026

Introduces a new skeleton utility and integrate skeleton overlays into the GUI.

  • Added code for skeleton display
  • Added UI and rendering support for configurable skeleton appearance: color mode (solid or keypoint-gradient) and line thickness.
  • Skeleton JSON files specification is still a WIP and will be updated soon

This pull request adds comprehensive support for skeleton visualization in the main GUI window, allowing users to display and customize skeleton overlays based on model definitions. It introduces new UI controls for skeleton display and style, ensures compatibility with loaded models, and manages automatic enabling/disabling of skeleton features.
Additionally, the controls dock is improved for better layout and usability.

Skeleton visualization features:

  • Added new UI controls for skeleton display, color mode (solid or gradient), and thickness in the visualization settings group (_build_viz_group). These controls are enabled only when a compatible skeleton is available for the loaded model.
  • Implemented logic to load skeleton definitions from the model’s config.yaml, synchronize UI controls with skeleton style, and automatically enable or disable skeleton controls based on model compatibility (_configure_skeleton_for_model, _sync_skeleton_controls_from_model).
  • Integrated skeleton rendering into both preview and recording overlays, including handling for multi-pose arrays and auto-disabling the skeleton overlay if keypoint mismatches are detected (_render_overlays_for_recording, _try_draw_skeleton, _update_video_display). [1] [2] [3]
  • Added signal connections and handlers for skeleton controls, allowing live updates to skeleton display and style from the UI (_connect_signals, _on_show_skeleton_changed, _on_skeleton_style_changed). [1] [2]

Controls dock usability improvements:

  • Wrapped the controls widget in a QScrollArea and implemented logic to synchronize the dock’s minimum width with the controls content, ensuring proper layout and usability even with many controls (_setup_ui, _sync_controls_dock_min_width). [1] [2] [3]

Introduce a new skeleton utility and integrate skeleton overlays into the GUI. Adds dlclivegui/utils/skeleton.py (SkeletonModel, Skeleton, loaders, render status/codes) and a helper to load DLC config skeleton. Wire skeleton drawing into display.draw_pose and the main window: add UI checkbox, auto-enable/disable logic, model-based skeleton configuration, and safe handling when keypoint counts or shapes mismatch. Also add a QScrollArea for the controls dock to allow scrolling.

Remove unused demo code

Add skeleton UI controls and gradient coloring

Add UI and rendering support for configurable skeleton appearance: color mode (solid or keypoint-gradient) and line thickness. main_window.py: introduce skeleton color combo, thickness spinbox, handlers (_on_skeleton_style_changed, _sync_skeleton_controls_from_model), and wire these into model loading and drawing flow; enable/disable controls appropriately and preserve auto-disable behavior. gui/misc/color_dropdowns.py: add gradient swatch icon and helpers to create/populate/get/set a skeleton color combo (supports Gradient and solid BGR swatches). utils/display.py: add keypoint_colors_bgr(colormap, num_keypoints) to produce exact BGR colors from a Matplotlib colormap and remove direct skeleton coupling from draw_pose. utils/skeleton.py: ensure draw_many forwards style, color_override and keypoint_colors to per-pose draw calls and validates pose shapes/keypoint counts. Overall this enables gradient coloring of skeleton lines based on keypoint colormap and exposes user controls to tweak skeleton rendering.
@C-Achard C-Achard self-assigned this Mar 4, 2026
@C-Achard C-Achard added enhancement New feature or request gui Related to the GUI itself : windows and fields bugs, UI, UX, ... labels Mar 4, 2026
Introduce a first-class SkeletonStyle and SkeletonColorMode (and BGR alias) in config, and wire them through the GUI and skeleton utilities. Updates include:
- dlclivegui/config.py: add BGR type, SkeletonColorMode enum, Pydantic SkeletonStyle model, expose skeleton fields on VisualizationSettings and with_overlays on RecordingSettings, and helper color accessors.
- dlclivegui/gui/main_window.py: add _apply_viz_settings_to_ui/_apply_viz_settings_to_skeleton, create a unified _draw_skeleton_on_frame renderer, read/write skeleton style from UI, refactor and simplify skeleton enable/disable and model heuristics, and wire recording.with_overlays.
- dlclivegui/gui/misc/color_dropdowns.py: reuse BGR from config.
- dlclivegui/utils/skeleton.py: remove duplicate style/type definitions, import style and enums from config, and add module docstring.

These changes centralize skeleton styling, enable UI control and persistence of style, and clean up duplicate definitions across modules.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request gui Related to the GUI itself : windows and fields bugs, UI, UX, ...

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant