refactor: Update cutout and depth handling by removing unused functions and adjusting parameters

This commit is contained in:
2026-09-13 22:08:32 +08:00
parent a0dd6e4a88
commit 1bf858b17e
13 changed files with 88 additions and 326 deletions

View File

@@ -71,7 +71,7 @@ def test_camera_blur_preserves_rays_interior_protection_and_disconnected_surface
def test_cutout_fine_outline_blurs_depth_without_moving_projection():
def test_cutout_fine_outline_smooths_only_within_boundary_band():
from tests.support.depth_surface import surface
from anyimage.operators.cutout_tool.mesh import build_mesh
@@ -90,19 +90,16 @@ def test_cutout_fine_outline_blurs_depth_without_moving_projection():
image.pixels.foreach_set(pixels.ravel())
image.update()
set_value("Boundary Smooth", 0)
set_value("Smooth Weight", 0)
set_value("Smooth Weight", 1)
before, original_faces = evaluated(obj)
set_value("Boundary Smooth", 12)
after, result_faces = evaluated(obj)
assert result_faces == original_faces
assert after[:, 2].min() > before[:, 2].min() + 1
# Reference Depth = 1, Uniform Scale = 1 and Depth Scale = 1.
np.testing.assert_allclose(after[:, :2] / (1 - after[:, 2:3]),
before[:, :2] / (1 - before[:, 2:3]), atol=1e-6)
band = edge_band(original_faces, boundary_neighbors(original_faces))
interior = [i for i in range(len(before)) if i not in band]
assert interior
np.testing.assert_array_equal(after[interior], before[interior])
assert np.max(np.linalg.norm(after - before, axis=1)) > 1e-4
set_value("Boundary Smooth", 0)
np.testing.assert_array_equal(evaluated(obj)[0], before)