Debian Codegraph @

src/pycolmap/scene/point3d_test.py

raw
1 import numpy as np
2
3 import pycolmap
4
5
6 def test_point3d_default_init():
7 point = pycolmap.Point3D()
8 assert point is not None
9
10
11 def test_point3d_xyz_readwrite():
12 point = pycolmap.Point3D()
13 point.xyz = np.array([1.0, 2.0, 3.0])
14 np.testing.assert_array_almost_equal(point.xyz, [1.0, 2.0, 3.0])
15
16
17 def test_point3d_color_readwrite():
18 point = pycolmap.Point3D()
19 point.color = np.array([255, 128, 0], dtype=np.uint8)
20 np.testing.assert_array_equal(point.color, [255, 128, 0])
21
22
23 def test_point3d_error_readwrite():
24 point = pycolmap.Point3D()
25 point.error = 0.5
26 assert point.error == 0.5
27
28
29 def test_point3d_has_error():
30 point = pycolmap.Point3D()
31 result = point.has_error()
32 assert isinstance(result, bool)
33
34
35 def test_point3d_track_readwrite():
36 point = pycolmap.Point3D()
37 track = pycolmap.Track()
38 track.add_element(image_id=1, point2D_idx=0)
39 point.track = track
40 assert point.track.length() == 1
41
42
43 def test_point3d_map_empty():
44 point_map = pycolmap.Point3DMap()
45 assert len(point_map) == 0