修正 mini_npz 深度数据职责

This commit is contained in:
2026-08-12 18:27:40 +08:00
parent c3a151ad2c
commit e3d023cac5
4 changed files with 32 additions and 119 deletions

View File

@@ -87,21 +87,6 @@ class ImageDepthTest(unittest.TestCase):
self.assertEqual(depth.shape, (2, 3))
def test_extracts_optional_reference_depth(self):
with tempfile.TemporaryDirectory() as directory:
npz_path = Path(directory) / "results.npz"
np.savez_compressed(
npz_path,
depth=np.ones((1, 2, 2), dtype=np.float32),
snapform_reference_depth=np.float32(2.5),
)
reference_depth = self.image_depth.extract_reference_depth(
npz_path
)
self.assertEqual(reference_depth, 2.5)
def test_is_animated_image_accepts_movie_and_sequence(self):
self.assertTrue(
self.image_depth.is_animated_image(
@@ -384,6 +369,23 @@ class ImageDepthTest(unittest.TestCase):
self.assertEqual(depth.shape, (2, 3))
def test_raw_da3_depth_is_converted_only_for_displacement(self):
raw_depth = np.array(
((0.25, 1.0), (1.5, 2.0)),
dtype=np.float32,
)
displacement = self.image_depth.depth_displacement_values(raw_depth)
np.testing.assert_array_equal(
displacement,
np.array(((0.75, 0.0), (-0.5, -1.0)), dtype=np.float32),
)
np.testing.assert_array_equal(
raw_depth,
np.array(((0.25, 1.0), (1.5, 2.0)), dtype=np.float32),
)
def test_extracts_camera_intrinsics(self):
expected = np.array(
((100.0, 0.0, 50.0), (0.0, 120.0, 40.0), (0.0, 0.0, 1.0)),