add_point()

Adds a 3D Point to the file

Adds a point to theFile3D object. This should be a 3D point with an x, y and z values.

Parameters:

  • x (float): X value of the point
  • y (float): Y value of the point
  • z (float): Z value of the point
  • intensity(float): (Optional) intensity value. Useful for lidar sensor context.
  • device_id(str): (Optional) sensor or device identificator. This can be useful when users want to combine data from multiple sensors on the same point cloud.
  • timestamp(Date): (Optional) a Date object to identify the timestamp of the given points
  • is_ground(bool): (Optional) Identify a point as a ground point.

Returns

A list of all the points in the File3D object, including the newly added point.

Example:

# Please replace test_point_cloud.pcd with you PCD file for parsing. # We are assuming PCD file is not in binary form diffgram_3d_file = File3D(client = project, name = 'test_point_cloud.pcd') points_arr = [] # Open PCD File with open('test_point_cloud.pcd') as f: lines = f.readlines() is_on_points = False # Loop through each line of the PCD File and parse the X,Y,Z Points. for line in lines: if not is_on_points: if line.startswith('DATA'): is_on_points = True else: data = line.split(' ') row = [] for elm in data: row.append(float(elm)) row[3] = min((row[3] / 100, 1.0)) points_arr.append(row) for i in range(0, len(points_arr)): point = points_arr[i] # Add point data to Diffgram File3D object. diffgram_3d_file.add_point( x = point[0], y = point[1], z = point[2], intensity = point[3] )

Did this page help you?