Skip to content

Add Magic Wand tool for region selection based on color/pixel similarity (like Photoshop) #1364

Description

@zhangbest5

Search before asking

  • I have searched the X-AnyLabeling issues and found no similar feature requests.

Description

问题描述

目前在做像素级标注时,对于颜色/纹理相近的区域(如天空、草地、墙面等),需要手动点击多边形描点,非常费时。希望增加类似Photoshop的"魔棒"工具。

期望功能

  1. 点击图像上某个像素,自动选取颜色相近的连通区域
  2. 提供"容差(Tolerance)"滑动条,控制选取敏感度
  3. 支持按住Shift追加选区、Alt减去选区
  4. 选区可直接转为多边形标注

现有替代方案

目前X-AnyLabeling已集成SAM系列模型,可通过点击正/负点生成分割掩码,但:

  • SAM需要加载大模型,启动慢,资源占用高
  • SAM基于语义理解,对于纯色连片区域反而不如魔棒直接

建议实现方式

参考OpenCV的 floodFill 算法实现,轻量快速,无需加载AI模型。

感谢开发者!

Problem

When doing pixel-level annotation, selecting large continuous areas (sky, grass, walls, etc.) requires manually clicking many polygon points, which is very time-consuming.

Requested Feature

  1. Click on a pixel → automatically select connected region with similar color
  2. Add a "Tolerance" slider to control selection sensitivity
  3. Support Shift+click to add, Alt+click to subtract from selection
  4. Convert the selection directly to a polygon annotation

Current Workaround

X-AnyLabeling already integrates SAM models, which can generate masks via point prompts. However:

  • SAM requires loading large models (slow startup, high resource usage)
  • For large uniform-color areas, SAM is overkill

Suggested Implementation

A lightweight flood fill algorithm (like OpenCV's floodFill) without requiring AI model loading.

Thanks for considering!

Use case

No response

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestwontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions