Iterate through the vertices in a point cloud
Hi,
I am trying to iterate through points in my point cloud using pyrealsense.points.get_vertices() in a for loop, made by my D435 series camera. However, BufData is not iterable, and neither is the pointcloud itself. What else should I try to get these points?
My non-working code is below. The formatting is fine on the actual IDE.
for p in np.asarray(list(points.get_vertices())):
x = p[0]
y = p[1]
z = p[2]
r = 1.0
g = 1.0
b = 1.0
vertWriter.addData3f(x, y, z)
normWriter.addData3f(0.0, 0.0, 1.0)
colorWriter.addData4f(r, g, b, 1.0)
x = p[0]
y = p[1]
z = p[2]
r = 1.0
g = 1.0
b = 1.0
vertWriter.addData3f(x, y, z)
normWriter.addData3f(0.0, 0.0, 1.0)
colorWriter.addData4f(r, g, b, 1.0)
-
Hi Edenclaire8 I am not certain if this is what you are looking for, but once you have used points.get_vertices() with a numpy array then you can retrieve XYZ coordinates from the vertices, like in the Python script at the link below.
https://github.com/IntelRealSense/librealsense/issues/4612#issuecomment-566864616
-
That was exactly what I was looking for. Thanks MartyG!
Please sign in to leave a comment.
Comments
2 comments