Refactor depth-related tests and improve parameter handling in image cutout symmetry
This commit is contained in:
@@ -137,7 +137,7 @@ def test_plane_validity_hole_blurs_depth_and_protects_rectangle():
|
||||
|
||||
|
||||
@pytest.mark.parametrize("region", ["seam", "pole"])
|
||||
def test_panorama_blurs_opening_radially_and_keeps_invalid_distance(region):
|
||||
def test_panorama_blurs_opening_radially(region):
|
||||
from tests.tools.nodes.test_image_depth_panorama import panorama, evaluated as panorama_mesh
|
||||
|
||||
yy, xx = np.mgrid[:64, :128]
|
||||
@@ -162,21 +162,3 @@ def test_panorama_blurs_opening_radially_and_keeps_invalid_distance(region):
|
||||
np.testing.assert_allclose(after[interior] / smoothed[interior, None],
|
||||
before[interior] / radii[interior, None], atol=1e-6)
|
||||
np.testing.assert_array_equal(after[interior], before[interior])
|
||||
set_value("Depth Mask", False)
|
||||
near = panorama_mesh(obj)[0]
|
||||
set_value("Invalid Distance", 250)
|
||||
far, far_faces, _ = panorama_mesh(obj)
|
||||
valid = np.linalg.norm(near, axis=1) < 50
|
||||
assert valid.any() and (~valid).any()
|
||||
np.testing.assert_array_equal(far[valid], near[valid])
|
||||
# The smoothed rim blends into its neighbours, so only the interior keeps the exact distance.
|
||||
far_band = edge_band(far_faces, boundary_neighbors(far_faces))
|
||||
kept = [i for i in range(len(far)) if i not in far_band and not valid[i]]
|
||||
assert kept
|
||||
np.testing.assert_allclose(np.linalg.norm(far[kept], axis=1), 250, atol=5e-5)
|
||||
set_value("Depth Scale", 0)
|
||||
sphere, sphere_faces, _ = panorama_mesh(obj)
|
||||
sphere_band = edge_band(sphere_faces, boundary_neighbors(sphere_faces))
|
||||
interior = [i for i in range(len(sphere)) if i not in sphere_band]
|
||||
assert interior
|
||||
np.testing.assert_allclose(np.linalg.norm(sphere[interior], axis=1), 1, atol=1e-6)
|
||||
|
||||
Reference in New Issue
Block a user