| 1 |
import numpy as np |
| 2 |
|
| 3 |
from .depth_covisibility import compute_covisibility_counts |
| 4 |
|
| 5 |
|
| 6 |
def test_compute_covisibility_counts_identical_views(): |
| 7 |
depths = np.full((2, 4, 8), 80, dtype=np.uint16) |
| 8 |
world_from_cameras = np.repeat(np.eye(4)[np.newaxis], 2, axis=0) |
| 9 |
counts = compute_covisibility_counts( |
| 10 |
depths, world_from_cameras, depth_scale=8.0, stride=1 |
| 11 |
) |
| 12 |
np.testing.assert_array_equal(counts, np.full((2, 2), 32)) |
| 13 |
|
| 14 |
|
| 15 |
def test_compute_covisibility_counts_rejects_disjoint_views(): |
| 16 |
depths = np.full((2, 4, 8), 80, dtype=np.uint16) |
| 17 |
world_from_cameras = np.repeat(np.eye(4)[np.newaxis], 2, axis=0) |
| 18 |
world_from_cameras[1, 0, 3] = 100.0 |
| 19 |
counts = compute_covisibility_counts( |
| 20 |
depths, world_from_cameras, depth_scale=8.0, stride=1 |
| 21 |
) |
| 22 |
assert counts[0, 1] == 0 |
| 23 |
assert counts[1, 0] == 0 |