Skip to content

Commit 4e3f9c9

Browse files
update test
1 parent 0345b8f commit 4e3f9c9

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

tests/test_multicam_smoother.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,17 @@ def __init__(self, cameras):
505505
self.cameras = cameras
506506

507507
def triangulate(self, xy_views, fast=True):
508-
xy = np.asarray(xy_views)
509-
return np.array([xy[:, 0].mean(), xy[:, 1].mean(), 1.0], dtype=float)
508+
xy = np.asarray(xy_views) # (C, 2) or (C, N, 2)
509+
if xy.ndim == 2:
510+
# single point: (C, 2) -> (3,)
511+
return np.array([xy[:, 0].mean(), xy[:, 1].mean(), 1.0], dtype=float)
512+
else:
513+
# batched: (C, N, 2) -> (N, 3)
514+
return np.stack([
515+
xy[:, :, 0].mean(axis=0),
516+
xy[:, :, 1].mean(axis=0),
517+
np.ones(xy.shape[1]),
518+
], axis=-1).astype(float)
510519

511520

512521
def test_make_projection_from_camgroup_single_point_concat_order():

0 commit comments

Comments
 (0)