Files
AnyImage/docs/image-tools.md
nan f42cba1932 Add image extraction functionality with background removal
- Implemented ExtractImageRegion operator for extracting image regions using box or lasso selection.
- Added RemoveImageRegionBackground job for background removal from selected image regions.
- Created utility functions for polygon bounds, selection canvas creation, and applying selection masks.
- Integrated image processing using PIL and numpy for efficient pixel manipulation.
- Enhanced user experience with modal drawing and status updates during extraction.
2026-08-22 15:47:34 +08:00

86 lines
3.3 KiB
Markdown
Raw 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.
# Image Box、Lasso 与 Perspective
这三个工具用于从 Image Empty 中提取局部图片。结果仍是 Image Empty,并自动 Pack 到 `.blend`。
它们只处理静态图片。视频和序列帧请使用其他转换工具。
## 选择工具
| 工具 | 适合 |
| --- | --- |
| **Image Box** | 提取矩形区域,操作最快 |
| **Image Lasso** | 沿物体或不规则边界自由绘制 |
| **Image Perspective** | 将海报、屏幕、门窗等四边形内容矫正为矩形 |
在 3D Viewport 左侧工具栏找到 Image 工具组。长按当前图标可以切换三个工具;设置位于 Tool Settings。
<div class="screenshot-placeholder" markdown>
**截图占位:工具组与 Tool Settings**
建议同时显示三个工具入口,以及 Remove Background、Continuous、Padding。
目标文件:`images/image-tools/tool-group.png`
</div>
## 选择源图片
如果当前 Active 已是目标图片,可以直接开始取区。
如果要处理另一张图片,先点击它。这一次点击只负责选择;下一次点击或拖动才开始取区。点击空白处或其他类型的对象时,工具继续使用当前 Active 图片。
!!! tip
最简单的习惯是:先点一下目标图片确认 Active,再开始绘制。
## 使用 Box 或 Lasso
=== "Image Box"
1. 按住左键,从区域一角拖到另一角。
2. 松开左键,立即生成结果。
=== "Image Lasso"
1. 按住左键,沿需要保留的区域绘制。
2. 松开左键,立即生成结果。
选区可以越过图片边缘。只要范围内仍有可见像素,工具就会按实际内容裁切。
<div class="screenshot-placeholder" markdown>
**截图占位:Box 与 Lasso 取区**
建议用一张并排图展示矩形拖拽和自由轮廓,不需要额外结果图。
目标文件:`images/image-tools/box-lasso.png`
</div>
## 使用 Perspective
1. 依次点击内容的四个角,顺序不限。
2. 第四点完成后,Viewport 中央会显示矫正预览。
3. 左右移动鼠标调整宽高比。
4. 单击左键确认并生成结果。
调整比例时按住 `Ctrl`,可以吸附到 `1:1`、`4:3`、`3:4`、`16:9` 和 `9:16`。`Backspace` 返回上一个角点;右键或 `Esc` 取消。
<div class="screenshot-placeholder" markdown>
**截图占位:Perspective 比例确认**
建议截取中央图片预览、蓝色边框、比例文字和底部操作提示。
目标文件:`images/image-tools/perspective-aspect.png`
</div>
## 结果设置
- **Remove Background**:使用 BEN2 删除选区内的背景,再按可见内容裁切。首次使用需要先完成 AI Environment 与 BEN2 配置。
- **Continuous**:保留源图片,连续创建新结果。新图片会向当前 View 稍微靠近,减少重叠闪烁。
- **Padding**:在可见内容四周增加透明像素,单位为 px。
Continuous 关闭时,结果会原位替换当前 Image Empty;开启时,源图片保持 Active,便于继续提取其他区域。
## Perspective 的结果位置
Perspective 会矫正图片内容,但不会尝试还原真实相机或空间平面。结果沿用源图片的朝向和深度,并大致放在原四边形覆盖的区域。
需要了解交互状态、像素处理和模块职责时,请阅读 [Image 工具技术实现](image-tools-technical.md)。