| 1 |
import pycolmap |
| 2 |
|
| 3 |
|
| 4 |
def test_frame_default_init(): |
| 5 |
frame = pycolmap.Frame() |
| 6 |
assert frame is not None |
| 7 |
|
| 8 |
|
| 9 |
def test_frame_frame_id_readwrite(): |
| 10 |
frame = pycolmap.Frame() |
| 11 |
frame.frame_id = 5 |
| 12 |
assert frame.frame_id == 5 |
| 13 |
|
| 14 |
|
| 15 |
def test_frame_rig_id_readwrite(): |
| 16 |
frame = pycolmap.Frame() |
| 17 |
frame.rig_id = 3 |
| 18 |
assert frame.rig_id == 3 |
| 19 |
|
| 20 |
|
| 21 |
def test_frame_has_rig_id(): |
| 22 |
frame = pycolmap.Frame() |
| 23 |
frame.rig_id = 1 |
| 24 |
assert frame.has_rig_id() |
| 25 |
|
| 26 |
|
| 27 |
def test_frame_add_data_id(): |
| 28 |
frame = pycolmap.Frame() |
| 29 |
data_id = pycolmap.data_t() |
| 30 |
data_id.sensor_id = pycolmap.sensor_t(type=pycolmap.SensorType.CAMERA, id=0) |
| 31 |
data_id.id = 1 |
| 32 |
frame.add_data_id(data_id) |
| 33 |
assert frame.num_data_ids() == 1 |
| 34 |
|
| 35 |
|
| 36 |
def test_frame_num_data_ids(): |
| 37 |
frame = pycolmap.Frame() |
| 38 |
assert frame.num_data_ids() == 0 |
| 39 |
|
| 40 |
|
| 41 |
def test_frame_has_data(): |
| 42 |
frame = pycolmap.Frame() |
| 43 |
data_id = pycolmap.data_t() |
| 44 |
data_id.sensor_id = pycolmap.sensor_t(type=pycolmap.SensorType.CAMERA, id=0) |
| 45 |
data_id.id = 1 |
| 46 |
frame.add_data_id(data_id) |
| 47 |
assert frame.has_data(data_id) |
| 48 |
|
| 49 |
|
| 50 |
def test_frame_clear_data_ids(): |
| 51 |
frame = pycolmap.Frame() |
| 52 |
data_id = pycolmap.data_t() |
| 53 |
data_id.sensor_id = pycolmap.sensor_t(type=pycolmap.SensorType.CAMERA, id=0) |
| 54 |
data_id.id = 1 |
| 55 |
frame.add_data_id(data_id) |
| 56 |
frame.clear_data_ids() |
| 57 |
assert frame.num_data_ids() == 0 |
| 58 |
|
| 59 |
|
| 60 |
def test_frame_finalize_data_ids(): |
| 61 |
frame = pycolmap.Frame() |
| 62 |
data_id = pycolmap.data_t() |
| 63 |
data_id.sensor_id = pycolmap.sensor_t(type=pycolmap.SensorType.CAMERA, id=0) |
| 64 |
data_id.id = 1 |
| 65 |
frame.add_data_id(data_id) |
| 66 |
frame.finalize_data_ids() |
| 67 |
assert frame.has_final_data_ids() |
| 68 |
|
| 69 |
|
| 70 |
def test_frame_has_final_data_ids(): |
| 71 |
frame = pycolmap.Frame() |
| 72 |
assert not frame.has_final_data_ids() |
| 73 |
|
| 74 |
|
| 75 |
def test_frame_data_ids_property(): |
| 76 |
frame = pycolmap.Frame() |
| 77 |
data_ids = frame.data_ids |
| 78 |
assert hasattr(data_ids, "__len__") |
| 79 |
|
| 80 |
|
| 81 |
def test_frame_data_ids_by_sensor(): |
| 82 |
frame = pycolmap.Frame() |
| 83 |
data_ids = frame.data_ids_by_sensor(pycolmap.SensorType.CAMERA) |
| 84 |
assert isinstance(data_ids, list) |
| 85 |
|
| 86 |
|
| 87 |
def test_frame_image_ids_property(): |
| 88 |
frame = pycolmap.Frame() |
| 89 |
image_ids = frame.image_ids |
| 90 |
assert isinstance(image_ids, list) |
| 91 |
|
| 92 |
|
| 93 |
def test_frame_has_pose(): |
| 94 |
frame = pycolmap.Frame() |
| 95 |
assert not frame.has_pose() |
| 96 |
|
| 97 |
|
| 98 |
def test_frame_reset_pose(): |
| 99 |
frame = pycolmap.Frame() |
| 100 |
frame.reset_pose() |
| 101 |
assert not frame.has_pose() |
| 102 |
|
| 103 |
|
| 104 |
def test_frame_map_empty(): |
| 105 |
frame_map = pycolmap.FrameMap() |
| 106 |
assert len(frame_map) == 0 |
| 107 |
|
| 108 |
|
| 109 |
def test_frame_map_insert_and_access(): |
| 110 |
frame_map = pycolmap.FrameMap() |
| 111 |
frame = pycolmap.Frame() |
| 112 |
frame.frame_id = 1 |
| 113 |
frame_map[1] = frame |
| 114 |
assert len(frame_map) == 1 |
| 115 |
assert frame_map[1].frame_id == 1 |