source-part-segmentation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSource Part Segmentation
源部件分割
Use this before when a source image contains overlapping or touching designed parts.
The output is not “nice masks”; it is a source-of-truth part inventory that downstream geometry must obey.
contour-to-mesh当源图像包含重叠或相互接触的设计部件时,请在之前使用此方法。
其输出并非"美观的掩码",而是下游几何流程必须遵循的真值部件清单。
contour-to-meshInputs
输入
- source image, wireframe, decal, or texture atlas;
- optional manual seed manifest with named parts, polygons, seed points, rough rectangles, or HSV/color ranges;
- source manifest with structural/decorative/context classification and expected part count.
- 源图像、线框、贴花或纹理图集;
- 可选的手动种子清单,包含命名部件、多边形、种子点、粗略矩形或HSV/颜色范围;
- 源清单,包含结构/装饰/上下文分类以及预期的部件数量。
Workflow
工作流程
- Choose the cleanest modality: alpha, edge, dark-line, bright-on-dark, color-band, or atlas region.
- Extract contours and hierarchy to identify candidate objects, holes, nested details, and strokes.
- If components touch, run distance-transform marker watershed first.
- If watershed over/under-splits, switch to seeded segmentation:
- create named part seeds (,
bbox, orpolygon+ optional flood/HSV tolerance);seed_point - save one mask per named structural part;
- mark ambiguous overlaps explicitly instead of merging them.
- create named part seeds (
- Classify masks as ,
structural,decorative,face_feature, oraura_context.validation_only - Pass structural masks to ; pass feature masks/landmarks to
contour-to-mesh; pass atlas regions tolandmark-fit-repair.atlas-uv-fitting
- 选择最清晰的模态:alpha通道、边缘、暗线、暗底亮纹、色带或图集区域。
- 提取轮廓和层级结构,以识别候选对象、孔洞、嵌套细节和笔触。
- 如果组件相互接触,首先运行距离变换标记分水岭算法。
- 如果分水岭算法出现过分割或欠分割,切换为种子分割:
- 创建命名部件种子(、
bbox或polygon+ 可选的泛洪/HSV容差);seed_point - 每个命名的结构部件保存为一个掩码;
- 明确标记模糊的重叠区域,而非将其合并。
- 创建命名部件种子(
- 将掩码分类为、
structural、decorative、face_feature或aura_context。validation_only - 将结构掩码传入;将特征掩码/地标传入
contour-to-mesh;将图集区域传入landmark-fit-repair。atlas-uv-fitting
Hard rules
硬性规则
- Do not infer repeated parts from symmetry; segment what the source shows.
- Do not merge overlapping components if the manifest expects separate structural meshes.
- Do not proceed to final modeling when part count differs between source images; write a conflict report or canonical policy.
- If automatic segmentation is ambiguous, write an ambiguity report and require or create manual seed rectangles/points.
- Keep stroke/line masks separate from filled-part masks; wireframe strokes are guides unless explicitly used as the contour boundary.
- 不要根据对称性推断重复部件;仅分割源图像中实际呈现的内容。
- 如果清单要求使用独立的结构网格,则不得合并重叠的组件。
- 当不同源图像的部件数量不一致时,不得进入最终建模阶段;需编写冲突报告或制定规范策略。
- 如果自动分割结果存在歧义,编写歧义报告,并要求或手动创建种子矩形/种子点。
- 笔触/线条掩码需与填充部件掩码分开保存;线框笔触仅作为参考,除非明确用作轮廓边界。
Seed manifest schema
种子清单模式
json
{
"schema": "source_part_seed_manifest.v1",
"image": "path/to/source.png",
"parts": [
{"name":"leaf_top", "class":"structural", "bbox":[x,y,w,h], "mode":"non_background"},
{"name":"face_shell", "class":"structural", "polygon":[[x,y],[x,y],...], "mode":"polygon"}
]
}Allowed values: , , , , , .
modepolygonbboxnon_backgrounddark_linesbright_on_darkhsv_rangejson
{
"schema": "source_part_seed_manifest.v1",
"image": "path/to/source.png",
"parts": [
{"name":"leaf_top", "class":"structural", "bbox":[x,y,w,h], "mode":"non_background"},
{"name":"face_shell", "class":"structural", "polygon":[[x,y],[x,y],...], "mode":"polygon"}
]
}允许的值:、、、、、。
modepolygonbboxnon_backgrounddark_linesbright_on_darkhsv_rangeScripts
脚本
- produces component masks and a JSON report from an image, with optional watershed.
scripts/segment_source_parts.py - converts a named seed manifest into deterministic named masks and a part inventory.
scripts/seeded_part_masks.py
- :从图像生成组件掩码和JSON报告,支持可选的分水岭算法。
scripts/segment_source_parts.py - :将命名种子清单转换为确定性的命名掩码和部件清单。
scripts/seeded_part_masks.py
Sources distilled
核心技术来源
- OpenCV contours/hierarchy/moments are the base measurement layer.
- OpenCV distance transform + marker watershed is the first automated split method for touching components.
- Active contour refinement can improve a rough mask boundary after segmentation.
- OpenCV的轮廓/层级/矩是基础测量层。
- OpenCV距离变换 + 标记分水岭是处理接触组件的首选自动分割方法。
- 活动轮廓细化可在分割后优化粗略的掩码边界。