@@ -75,9 +75,12 @@ def _get_point_cloud_reader(self):
75
75
# This is easy, the old KITTI format
76
76
if self .file_extension == "bin" :
77
77
print ("[WARNING] Reading .bin files, the only format supported is the KITTI format" )
78
- return lambda file : np .fromfile (file , dtype = np .float32 ).reshape ((- 1 , 4 ))[
79
- :, :3
80
- ], np .array ([])
78
+
79
+ class ReadKITTI :
80
+ def __call__ (self , file ):
81
+ return np .fromfile (file , dtype = np .float32 ).reshape ((- 1 , 4 ))[:, :3 ], np .array ([])
82
+
83
+ return ReadKITTI ()
81
84
82
85
print ('Trying to guess how to read your data: `pip install "kiss-icp[all]"` is required' )
83
86
first_scan_file = self .scan_files [0 ]
@@ -118,17 +121,27 @@ def __call__(self, file):
118
121
import trimesh
119
122
120
123
trimesh .load (first_scan_file )
121
- return lambda file : np .asarray (trimesh .load (file ).vertices ), np .array ([])
124
+
125
+ class ReadTriMesh :
126
+ def __call__ (self , file ):
127
+ return np .asarray (trimesh .load (file ).vertices ), np .array ([])
128
+
129
+ return ReadTriMesh ()
122
130
except :
123
131
pass
124
132
125
133
try :
126
134
from pyntcloud import PyntCloud
127
135
128
136
PyntCloud .from_file (first_scan_file )
129
- return lambda file : PyntCloud .from_file (file ).points [
130
- ["x" , "y" , "z" ]
131
- ].to_numpy (), np .array ([])
137
+
138
+ class ReadPynt :
139
+ def __call__ (self , file ):
140
+ return PyntCloud .from_file (file ).points [["x" , "y" , "z" ]].to_numpy (), np .array (
141
+ []
142
+ )
143
+
144
+ return ReadPynt ()
132
145
except :
133
146
print ("[ERROR], File format not supported" )
134
147
sys .exit (1 )
0 commit comments