1

I have a point cloud with around 75 million points and I have already read the data files using laspy and they are stored in an array that looks like [x y z] where x values are in a column, y values are in a column and z values are in another column. I also have a derived 3x3 Rotation Matrix and a 3x1 Translation vector. When I am transforming the point cloud I am using the formula y=R@x+t however, this method is taking too long as it is being applied to all 75 million points

I was wondering if there is quicker way to apply the derived transformation parameters to my point cloud? Such as using any functions from laspy modules or other point cloud modules that make it easier to do this transformation?

I tried to individually apply the transformation to every point but it took a very long time. Are there any other ways to do this

ABh
  • 11
  • 2
  • If you use NumPy arrays you can apply the same equation you are using for each point on the full point-cloud at once. – D.Manasreh Oct 30 '22 at 21:22

1 Answers1

1

I am not sure if laspy outputs that data as NumPy arrays. If it doesn't then you would first convert your list of points into a numpy array. Next you can simply apply the transformation to the full matrix. You can try something like this:

point_cloud_array = np.array(point_cloud)
transformed_point_cloud = rotation_matrix @ point_cloud_array + translation_vector

It would be great if you provide more details so that we can help you better.

Edit: If you want a ready package, check out this tutorial. https://medium.com/@rdadlaney/basics-of-3d-point-cloud-data-manipulation-in-python-95b0a1e1941e

D.Manasreh
  • 900
  • 1
  • 5
  • 9
  • Hi, I was wondering what more details I should provide? So I have an array with [x,y,z] columns, with each column having x values y values and z values. So when I tired your method, it shows up as error cause the rotation is 3x3 and the array is 75 million x1. So the vector is gonna look like this [x1 y1 z1 x2 y2 z2...] however that method is taking too long and I was wondering if laspy or any other point cloud libraries have methods where I can easily transform the point cloud without going through the mentioned formula – ABh Oct 30 '22 at 22:00
  • So if the array has x,y,z columns then the array should have the shape 75million*3 Is this not the case? – D.Manasreh Oct 30 '22 at 22:02
  • When you do ```np.array(point_cloud)``` can you check how the output looks? It might be converting it to an array of [x,y,z] lists instead of a 2D array. Can you check if this is the case? – D.Manasreh Oct 30 '22 at 22:07
  • Yes thats true. However I was wondering if there was a quicker way to transform the point cloud using some point cloud library that can quickly transform the point cloud using the given transformation parameters – ABh Oct 30 '22 at 22:07
  • So when I didi np.array(point cloud) it is coming out like 75million x 3 array – ABh Oct 30 '22 at 22:09
  • Then if you also make the rotation matrix a 3x3 NumPy array, and the translation a 3x1 array the operations should work. Anyway if you want a ready package, check out this tutorial. https://medium.com/@rdadlaney/basics-of-3d-point-cloud-data-manipulation-in-python-95b0a1e1941e – D.Manasreh Oct 30 '22 at 22:12