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

Supervision 0.31 sees depth. ComparisonAnnotator now sees grayscale

说明与用途

ComparisonAnnotator 现在可以正确处理灰度图像,使得在深度、热成像和 MRI 图像上直接比较检测结果成为可能,无需转换为 BGR。

问题

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

结果

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.

工作流

  • 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.

证据

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

来源

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.

来源

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

来源

  • 记录日期: 2026-11-01T02:44:20.366Z