Files

41 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Multi Mask Math Ops - 遮罩二值运算
**节点功能:** `Mask Math Ops` 在多个遮罩之间执行逐像素二值化运算:`or`、`and`、`subtract (a-b)`、`subtract (b-a)`、`xor`。支持动态输入端口 `mask_1..mask_N`、批次广播与尺寸对齐。
## 输入
| 参数名称 | 入端选择 | 数据类型 | 默认值 | 取值范围 | 描述 |
| -------- | -------- | -------- | ------ | -------- | ---- |
| `mask_1` | - | MASK | - | - | 第一遮罩批次 |
| `mask_2..mask_N` | 可选(动态) | MASK | - | - | 其他遮罩批次;尺寸不一致时统一到 `mask_1` 尺寸 |
| `operation` | - | COMBO | `or` | `or` / `and` / `subtract (a-b)` / `subtract (b-a)` / `xor` | 运算类型 |
## 输出
| 输出名称 | 数据类型 | 描述 |
|---------|----------|------|
| `mask` | MASK | 运算后的遮罩批次 |
## 功能说明
- 动态端口:以 `mask_` 开头的输入端口支持自动扩展,连接尾端空槽时自动追加。
- 批次广播:当各输入批次大小不一致时,按索引取模进行对齐与计算。
- 尺寸统一:将其他遮罩统一到 `mask_1` 的尺寸,使用 Lanczos 重采样对齐。
- 运算规则:
- `and`:逐像素取最小值。
- `or`:逐像素取最大值。
- `subtract (a-b)`:`clip(a-b, 0, 1)`。
- `subtract (b-a)`:`clip(b-a, 0, 1)`。
- `xor`:绝对差。
## 典型用法
- 遮罩组合:区域并/交以构建复合选区。
- 区域裁除:相互减法以精细化选区边界。
- 差异强调:`xor` 用于突显两遮罩的差异区域。
## 注意与建议
- 输入内部作为 `[0,1]` 浮点数组处理;单通道遮罩按逐像素运算。
- 在合并前确保遮罩强度语义一致(白=选中),避免语义冲突。