import numpy as np from depth_bridge import depth_view_to_points, fuse_depth_views def test_depth_bridge_projects_and_applies_world_transform(): depth = np.ones((2, 2), dtype=np.float32) colors = np.full((2, 2, 3), 100, dtype=np.uint8) pose = np.eye(4, dtype=np.float32) pose[0, 3] = 2.0 points, output_colors, confidence = depth_view_to_points(depth, colors, pose=pose) base_points, _, _ = depth_view_to_points(depth, colors) assert points.shape == (4, 3) assert np.allclose(output_colors, 100) assert np.allclose(confidence, 1.0) assert np.allclose(points[:, 0], base_points[:, 0] - 2.0) def test_depth_bridge_fuses_overlap_and_records_sources(): depth = np.ones((1, 1), dtype=np.float32) colors = np.zeros((1, 1, 3), dtype=np.uint8) result = fuse_depth_views([ {"depth": depth, "colors": colors}, {"depth": depth, "colors": colors}, ], voxel_size=10_000.0) assert len(result["points"]) == 1 assert result["source_masks"].tolist() == [3] assert result["source_views"].tolist() == [0]