Magicwand
Magicwand标签使用户能够在进行图像分割标注时,通过点击图像区域、拖动鼠标动态调整泛洪填充容差,然后释放鼠标按钮来生成新的标注区域。该功能特别适用于标注边缘宽泛、模糊、复杂的对象,例如地球观测应用中的云层、云影、雪地等,或生物医学应用中的有机形状。
适用于以下数据类型:图像。
魔术棒工具支持缩放功能,但在旋转后的图像上无法使用。
魔棒使用示例:

CORS配置
魔棒工具需要对正在标注的图像进行像素级访问,以便执行阈值处理和区域填充。如果您将待标注的图像托管在第三方域名上,则需要启用CORS头部信息,使魔棒工具能通过跨域HTTP GET请求获取实际图像像素数据来进行阈值处理。有关配置CORS的更多详情,请参阅Label Studio存储指南。
Image 标签配置
The Magicwand tag is configured to work with an Image tag that it will operate on for labeling.
If you are storing an image cross-domain that the Image tag will reference, you will have to
correctly setup the crossOrigin on the Image attribute. This attribute mimics the same
crossOrigin attribute that a normal DOM img tag would
have ([reference])(https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin).
如果图像位于公共服务器或无需任何认证即可公开读取的Google/AWS/Azure存储桶上,您应将crossOrigin设置为anonymous。
如果图像位于需要任何形式身份验证的服务器或私有云存储桶上(即请求必须携带证明身份验证的HTTP头部信息与第三方请求一起发送),那么您应该将crossOrigin设置为use-credentials。请注意,谷歌的云存储桶不支持CORS请求的身份验证请求,这意味着您要么需要将该谷歌存储桶设置为全局可读以使用Magic Wand功能,要么使用Label Studio的签名URL支持(AWS、GCP和Azure)。
如果图像与您的Label Studio实例位于同一主机上,您可以简单地省略crossOrigin属性或将其设置为none。
参数
| 参数 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| name | string |
Name of the element | |
| toName | string |
Name of the image to label | |
| [opacity] | float |
0.6 |
Opacity of the Magic Wand region during use |
| [blurradius] | number |
5 |
The edges of a Magic Wand region are blurred and simplified, this is the radius of the blur kernel |
| [defaultthreshold] | number |
15 |
When the user initially clicks without dragging, how far a color has to be from the initial selected pixel to also be selected |
结果参数
| 名称 | 类型 | 描述 |
|---|---|---|
| original_width | number |
Width of the original image (px) |
| original_height | number |
Height of the original image (px) |
| image_rotation | number |
Rotation degree of the image (deg) |
| value | Object |
|
| value.format | "rle" |
Format of the masks, only RLE is supported for now |
| value.rle | Array.<number> |
RLE-encoded image |
示例JSON
{
"original_width": 1920,
"original_height": 1280,
"image_rotation": 0,
"value": {
"format": "rle",
"rle": [0, 1, 1, 2, 3],
"brushlabels": ["Car"]
}
}
示例
基础图像分割标注配置,图像存储在第三方公共云存储桶中:
<View>
<Labels name="labels" toName="image">
<Label value="Person" />
<Label value="Animal" />
</Labels>
<MagicWand name="magicwand" toName="image" />
<Image name="image" value="$image" crossOrigin="anonymous" />
</View>
示例
带有缩放控制和开启笔刷功能的魔棒示例:
<View>
<Labels name="labels" toName="image">
<Label value="Person" />
<Label value="Animal" />
</Labels>
<MagicWand name="magicwand" toName="image" />
<Brush name="brush" toName="image" />
<Image name="image" value="$image" zoomControl="true" zoom="true" crossOrigin="anonymous" />
</View>