@@ -198,10 +198,12 @@ def __init__(
198
198
199
199
if len (np_data .shape ) != 2 or np_data .shape [1 ] not in {3 , 4 , 6 }:
200
200
raise ValueError (
201
- """The shape of the numpy array must be one of either
201
+ """
202
+ The shape of the numpy array must be one of either
202
203
[[x y z], ...] nx3
203
204
[x y z c], ...] nx4 where c is a category with supported range [1, 14]
204
- [x y z r g b], ...] nx4 where is rgb is color"""
205
+ [x y z r g b], ...] nx6 where rgb is color
206
+ """
205
207
)
206
208
207
209
list_data = np_data .tolist ()
@@ -224,6 +226,13 @@ def from_file(
224
226
data_or_path : Union ["TextIO" , str ],
225
227
file_type : Optional ["FileFormat3D" ] = None ,
226
228
) -> "Object3D" :
229
+ """Initializes Object3D from a file or stream.
230
+
231
+ Arguments:
232
+ data_or_path (Union["TextIO", str]): A path to a file or a `TextIO` stream.
233
+ file_type (str): Specifies the data format passed to `data_or_path`. Required when `data_or_path` is a
234
+ `TextIO` stream. This parameter is ignored if a file path is provided. The type is taken from the file extension.
235
+ """
227
236
# if file_type is not None and file_type not in cls.SUPPORTED_TYPES:
228
237
# raise ValueError(
229
238
# f"Unsupported file type: {file_type}. Supported types are: {cls.SUPPORTED_TYPES}"
@@ -232,15 +241,31 @@ def from_file(
232
241
233
242
@classmethod
234
243
def from_numpy (cls , data : "np.ndarray" ) -> "Object3D" :
244
+ """Initializes Object3D from a numpy array.
245
+
246
+ Arguments:
247
+ data (numpy array): Each entry in the array will
248
+ represent one point in the point cloud.
249
+
250
+
251
+ The shape of the numpy array must be one of either:
252
+ ```
253
+ [[x y z], ...] # nx3.
254
+ [[x y z c], ...] # nx4 where c is a category with supported range [1, 14].
255
+ [[x y z r g b], ...] # nx6 where is rgb is color.
256
+ ```
257
+ """
235
258
if not util .is_numpy_array (data ):
236
259
raise ValueError ("`data` must be a numpy array" )
237
260
238
261
if len (data .shape ) != 2 or data .shape [1 ] not in {3 , 4 , 6 }:
239
262
raise ValueError (
240
- """The shape of the numpy array must be one of either
263
+ """
264
+ The shape of the numpy array must be one of either:
241
265
[[x y z], ...] nx3
242
266
[x y z c], ...] nx4 where c is a category with supported range [1, 14]
243
- [x y z r g b], ...] nx4 where is rgb is color"""
267
+ [x y z r g b], ...] nx6 where rgb is color
268
+ """
244
269
)
245
270
246
271
return cls (data )
@@ -254,6 +279,16 @@ def from_point_cloud(
254
279
point_cloud_type : "PointCloudType" = "lidar/beta" ,
255
280
# camera: Optional[Camera] = None,
256
281
) -> "Object3D" :
282
+ """Initializes Object3D from a python object.
283
+
284
+ Arguments:
285
+ points (Sequence["Point"]): The points in the point cloud.
286
+ boxes (Sequence["Box3D"]): 3D bounding boxes for labeling the point cloud. Boxes
287
+ are displayed in point cloud visualizations.
288
+ vectors (Optional[Sequence["Vector3D"]]): Each vector is displayed in the point cloud
289
+ visualization. Can be used to indicate directionality of bounding boxes. Defaults to None.
290
+ point_cloud_type ("lidar/beta"): At this time, only the "lidar/beta" type is supported. Defaults to "lidar/beta".
291
+ """
257
292
if point_cloud_type not in cls .SUPPORTED_POINT_CLOUD_TYPES :
258
293
raise ValueError ("Point cloud type not supported" )
259
294
0 commit comments