Files
AnyImage/openspec/changes/improve-cutout-adaptive-mesh/implementation.md
nan 7e55af6722 Add comprehensive tests for edge depth extension, empty image edits, and material view adaptation
- Introduced `test_edge_depth.py` to validate the functionality of edge depth extension, ensuring core alpha preservation, proper depth handling, and edge padding behavior.
- Created `test_empty_image_edits.py` to verify the behavior of image edits in Blender, focusing on shared edits, preservation of image properties, and handling of failed operations.
- Developed `test_material_view_adaptation.py` to test material adaptation preferences, ensuring color space and alpha settings are correctly applied and preserved across various scenarios.
2026-09-06 21:43:47 +08:00

3.8 KiB
Raw Blame History

实施验收

2026-09-06,Windows、Python 3.11、bpy 4.5.3。Fine Outline 默认开启;关闭调用原有轮廓平滑和均匀布点流程。

数值构建

计时包含已加载 Alpha 的过滤、轮廓、路径、布点、三角化及 Poisson 高度;不含抠图、依赖首次导入、对象创建。四张原样本预热后取三次中位数;复杂蕨叶每档一次,供开销判断。两种模式均使用 32 / 16 / 8 / 4 像素目标间距。

样本 间距 px 原算法 ms Fine Outline ms 原算法点数 Fine Outline 点数
skull 32 32.7 118.4 411 486
skull 16 43.2 164.4 984 1112
skull 8 68.7 313.5 3233 3472
skull 4 285.3 862.0 11983 12239
spider 32 195.8 235.7 1752 953
spider 16 211.2 310.5 2198 1736
spider 8 243.3 661.7 3549 3879
spider 4 336.4 1303.4 9272 10076
beetle 32 22.8 62.8 184 268
beetle 16 23.9 83.2 322 459
beetle 8 33.9 130.0 804 1001
beetle 4 56.8 274.8 2519 2797
cartoon 32 3.0 20.0 16 47
cartoon 16 3.1 25.2 52 96
cartoon 8 4.9 34.0 188 243
cartoon 4 11.2 61.0 702 755
fern 32 796.9 15637.6 4217 13946
fern 16 814.1 10733.5 4861 11961
fern 8 2226.1 20422.6 10546 18226
fern 4 2431.2 25987.0 17748 26353

二十组精细网格均无两端处于边界的内部边,所有内部顶点的 Poisson 高度为正。复杂蕨叶 Low 的拓扑重试提高了局部精度,点数可能高于 Medium;Mesh Detail 表示目标间距,实际数量还受轮廓拓扑约束影响。密集分枝使用精细模式仍有明显等待,关闭可获得原算法的概括效果。

大图与内存

合成前景包含 36 个孔洞及多个独立碎片,网格分辨率上限设置为 128。峰值为独立 Python 进程的 PeakWorkingSetSize,包含 bpy 与数值依赖,不等同于单个数组占用。

分辨率 受限间距 px 耗时 ms 顶点 峰值 MiB
2048² 16.0 876.9 4802 470.3
4096² 32.0 3827.1 4820 1182.2

网格点数保持在相近规模;源像素中轴计算的时间与内存仍随图像面积增长。两组均通过零高度内部边与正内部高度检查。

依赖与打包

客户端新增 NumPy >=1.26,<2.0、SciPy 1.15.3、scikit-image 0.25.2;uv.lock 已同步。使用项目打包器的 Python 3.11 与平台参数实际下载全部数值 wheel,三平台均成功。

平台 数值 wheel 数 压缩体积 MiB
linux 9 77.8
macos 9 61.8
windows 9 76.2

数值 wheel 体积包含传递依赖,不含原有 BlendJob。实际平台 Manifest 由打包器使用解析出的全部 wheel 名称生成,已增加对应测试;源 Manifest 的平台集合保持一致。本次仅做依赖与测试校验。

自动验证

  • Cutout 几何、交互、对象、Blender 注册、Manifest 与打包:270 passed、29 subtests passed,退出码 0。
  • 其余全部测试:318 passed、2 xfailed、27 subtests passed,退出码 0。
  • 单进程全量测试的断言结果为 588 passed、2 xfailed、56 subtests passed,但解释器退出阶段出现 Windows 原生访问异常(0xC0000005);原因尚未确定。分组复跑覆盖全部用例且均正常退出。
  • OpenSpec strict validate 通过。

新增回归覆盖弯腿、变宽关节、1 像素平移、相邻密度、单像素桥、孔洞、密集分枝、极小岛、阈值与输入不变性、源轮廓双向误差、索引与穷举一致性、均匀化误差、CDT 拆分约束、菜单模式快照,以及关闭模式与原流程逐数组一致。既有对象测试覆盖四种 Shape、TEDDY/Poisson 高度消费和非均匀世界变换。