Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Supervision 0.31 sees depth. ComparisonAnnotator now sees grayscale

Description and use

ComparisonAnnotator now correctly handles grayscale images, enabling detection comparison on depth, thermal, and MRI images without converting to BGR.

Problem

ComparisonAnnotator crashed when annotating grayscale frames because it attempted to write three-channel colors into single-channel images.

Outcome

ComparisonAnnotator now handles grayscale frames, enabling direct comparison of detections on depth, thermal, and MRI images without conversion to BGR. The change adds 8 tests and improves library consistency.

Workflow

  • 1. Identify grayscale support gap by running a probe script on all annotators and image layouts.
  • 2. Search repository for existing grayscale handling; find _color_for_canvas helper added in #2755.
  • 3. Modify ComparisonAnnotator to pass its colors through _color_for_canvas.
  • 4. Add eight new tests that compare grayscale output to the first channel of BGR output across multiple detection types and image layouts.
  • 5. Run tests on both NumPy fallback and opencv-python backends; confirm all pass.
  • 6. Merge PR #2803 and update changelog.
  • 7. Notify users via release notes that grayscale comparison is now supported.

Evidence

ComparisonAnnotator raised a ValueError on all three single-channel inputs.

Source

The fix routes the annotator's three colours through that helper and adds eight tests that check grayscale output against the BGR output, channel for channel.

Source

All 8 fail on develop and pass with the change, on the NumPy fallback and on opencv-python 5.0.0.

Source

  • Record date: 2026-11-01T02:44:20.366Z