@@ -27,7 +27,8 @@ def to_labelled_cld(self, radii, direction, class_l) -> LabelledCloud:
2727 return LabelledCloud (self .xyz , self .rgb , radii * direction , class_l )
2828
2929 def to_o3d_cld (self ):
30- return o3d_cloud (self .xyz , colours = self .rgb )
30+ cpu_cld = self .to_device ("cpu" )
31+ return o3d_cloud (cpu_cld .xyz , colours = cpu_cld .rgb )
3132
3233 def filter (self , mask ):
3334 return Cloud (self .xyz [mask ], self .rgb [mask ])
@@ -50,8 +51,7 @@ def cat(self):
5051 )
5152
5253 def view (self ):
53- cpu_cld = self .to_device ("cpu" )
54- o3d_viewer ([cpu_cld .to_o3d_cld ()])
54+ o3d_viewer ([self .to_o3d_cld ()])
5555
5656 def voxel_down_sample (self , voxel_size ):
5757 idx = voxel_downsample (self .xyz , voxel_size )
@@ -111,6 +111,7 @@ def number_classes(self):
111111 @property
112112 def cmap (self ):
113113 return torch .rand (self .number_classes , 3 )
114+ < << << << HEAD
114115
115116 def __add__ (self , other ):
116117 xyz = torch .cat ((self .xyz , other .xyz ))
@@ -119,6 +120,8 @@ def __add__(self, other):
119120 class_l = torch .cat ((self .class_l , other .class_l ))
120121
121122 return LabelledCloud (xyz , rgb , vector , class_l )
123+ == == == =
124+ >> >> >> > revert
122125
123126 def filter (self , mask ):
124127 return LabelledCloud (
@@ -137,11 +140,7 @@ def filter_by_class(self, classes: List):
137140 return self .filter (mask )
138141
139142 def view (self , cmap = []):
140- if len (cmap ) != 0 :
141- cmap = cmap
142- else :
143- cmap = self .cmap
144-
143+ cmap = cmap if cmap != [] else self .cmap
145144 cpu_cld = self .to_device ("cpu" )
146145 input_cld = cpu_cld .to_o3d_cld ()
147146 segmented_cld = o3d_cloud (cpu_cld .xyz , colours = cmap [cpu_cld .class_l ])
@@ -210,17 +209,8 @@ def medial_pts(self):
210209 @staticmethod
211210 def from_numpy (xyz , rgb , vector , class_l ):
212211 return LabelledCloud (
213- torch .from_numpy (xyz ).float (), # -> these data types are stupid...
214- torch .from_numpy (rgb ).float (), # float64
215- torch .from_numpy (vector ).float (), # float32
216- torch .from_numpy (class_l ).int (), # int64
217- )
218-
219- @staticmethod
220- def from_o3d_cld (cld , class_l ):
221- return LabelledCloud .from_numpy (
222- xyz = np .asarray (cld .points ),
223- rgb = np .asarray (cld .colors ),
224- vector = np .asarray (cld .points ) * 0 - 1 ,
225- class_l = np .asarray (class_l ),
212+ torch .from_numpy (xyz ), # float64 -> these data types are stupid...
213+ torch .from_numpy (rgb ), # float64
214+ torch .from_numpy (vector ), # float32
215+ torch .from_numpy (class_l ), # int64
226216 )
0 commit comments