feat(perception): HSV color object segmenter (Issue #274) #281

Merged
sl-jetson merged 1 commits from sl-perception/issue-274-color-segment into main 2026-03-02 20:43:47 -05:00
Collaborator

Summary

  • Add ColorDetection.msg + ColorDetectionArray.msg to saltybot_scene_msgs
  • Add _color_segmenter.py: HsvRange/ColorBlob types, COLOR_RANGES defaults for red/green/blue/yellow/orange (dual-band wrap for red), mask_for_color(), find_color_blobs() with morphological open + contour extraction + area/count filtering
  • Add color_segment_node.py: subscribes /camera/color/image_raw (BEST_EFFORT), publishes /saltybot/color_objects (ColorDetectionArray) per frame; active_colors, min_area_px, max_blobs_per_color ROS params
  • Add saltybot_scene_msgs exec_depend to saltybot_bringup/package.xml
  • Register color_segmenter console script in setup.py
  • 34/34 unit tests pass (pure Python, no ROS2 required)

Test plan

  • python3 -m pytest test/test_color_segmenter.py -v → 34 passed
  • Launch on Jetson: ros2 run saltybot_bringup color_segmenter
  • Verify /saltybot/color_objects publishes ColorDetectionArray when coloured objects in view
  • Check red detection across hue wrap-around (near-0 and near-180)
  • Confirm active_colors param restricts output to requested colors

🤖 Generated with Claude Code

## Summary - Add `ColorDetection.msg` + `ColorDetectionArray.msg` to `saltybot_scene_msgs` - Add `_color_segmenter.py`: `HsvRange`/`ColorBlob` types, `COLOR_RANGES` defaults for red/green/blue/yellow/orange (dual-band wrap for red), `mask_for_color()`, `find_color_blobs()` with morphological open + contour extraction + area/count filtering - Add `color_segment_node.py`: subscribes `/camera/color/image_raw` (BEST_EFFORT), publishes `/saltybot/color_objects` (`ColorDetectionArray`) per frame; `active_colors`, `min_area_px`, `max_blobs_per_color` ROS params - Add `saltybot_scene_msgs` `exec_depend` to `saltybot_bringup/package.xml` - Register `color_segmenter` console script in `setup.py` - 34/34 unit tests pass (pure Python, no ROS2 required) ## Test plan - [ ] `python3 -m pytest test/test_color_segmenter.py -v` → 34 passed - [ ] Launch on Jetson: `ros2 run saltybot_bringup color_segmenter` - [ ] Verify `/saltybot/color_objects` publishes `ColorDetectionArray` when coloured objects in view - [ ] Check red detection across hue wrap-around (near-0 and near-180) - [ ] Confirm `active_colors` param restricts output to requested colors 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sl-perception added 1 commit 2026-03-02 17:33:02 -05:00
- Add ColorDetection.msg + ColorDetectionArray.msg to saltybot_scene_msgs
- Add _color_segmenter.py: HsvRange/ColorBlob types, COLOR_RANGES defaults,
  mask_for_color() (dual-band red wrap), find_color_blobs() with morph open,
  contour extraction, area filter and max-blob-per-color limit
- Add color_segment_node.py: subscribes /camera/color/image_raw (BEST_EFFORT),
  publishes /saltybot/color_objects (ColorDetectionArray) per frame;
  active_colors, min_area_px, max_blobs_per_color params
- Add saltybot_scene_msgs exec_depend to saltybot_bringup/package.xml
- Register color_segmenter console_script in setup.py
- 34/34 unit tests pass (no ROS2 required)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
sl-jetson merged commit cb8f6c82a4 into main 2026-03-02 20:43:47 -05:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: seb/saltylab-firmware#281
No description provided.