Items with no label
3335 Discussions

Help:get .ply pointcloud from pyrealsense2

York
Beginner
8,060 Views

Hi,

I have got pointcloud data from only one frame.But I want get pointcloud data from multiple frame.

I know can export .ply file from .bag file by realsense-viewer.So I think maybe by pyrealsense2 it can also come true.

What should I do?

Thanks in advance

The code:

pc = rs.pointcloud()

pc.map_to(color)

points = pc.calculate(depth) # only one frame

points.export_to_ply("xxx", color)

0 Kudos
12 Replies
MartyG
Honored Contributor III
6,004 Views

You could try converting the script below from an Intel point cloud tutorial for Python, which uses 'color_frame' and 'depth_frame' instead of 'color' and 'depth'.

pc = rs.pointcloud();

pc.map_to(color_frame);

pointcloud = pc.calculate(depth_frame);

pointcloud.export_to_ply("1.ply", color_frame);

cloud = PyntCloud.from_file("1.ply");

cloud.plot()

*******

Here's the link to the full tutorial.

https://github.com/dorodnic/binder_test/blob/master/pointcloud.ipynb binder_test/pointcloud.ipynb at master · dorodnic/binder_test · GitHub

0 Kudos
York
Beginner
6,004 Views

Hi MartyG,

Thanks for your reply.

I use 'color' and 'depth' which are just different names, I know they are got from frames.

I just want to know how to export .ply file with multiple frame.

Is there a function to achieve this?

Thank you

0 Kudos
MartyG
Honored Contributor III
6,004 Views

The 'export_ply_example' sample program for Python may meet your needs.

https://github.com/IntelRealSense/librealsense/blob/master/wrappers/python/examples/export_ply_example.py librealsense/export_ply_example.py at master · IntelRealSense/librealsense · GitHub

0 Kudos
York
Beginner
6,004 Views

Thank you for your warm reply.

I had seen the link several times.There is no usefule infromation about how to export .ply file from multple frames.

Maybe there is no function to achieve this in pyrealsense2.

0 Kudos
MartyG
Honored Contributor III
6,004 Views

There is another Python script in the link below for generating a point cloud and saving it as a ply. Is there anything in it that is helpful to you?

0 Kudos
idata
Employee
6,004 Views

Hi York_,

 

 

You should use a loop around your code like this:

 

while True:

 

# Wait for a coherent pair of frames: depth and color

 

frames = pipeline.wait_for_frames()

 

depth_frame = frames.get_depth_frame()

 

color_frame = frames.get_color_frame()

 

 

Regards,

 

Alexandra

 

 

0 Kudos
York
Beginner
6,004 Views

Thers is still no useful information.

Thank you.

0 Kudos
York
Beginner
6,004 Views

Thanks for your reply.

In this way, when 'pc.calculate(depth_frame)', there is also only one frame in it, right?

0 Kudos
York
Beginner
6,004 Views

Just now,I found that the .ply file exported from realsense-viewer just have one frame data.

It can export different .ply with different time in the .bag file from realsense-viewer.

So maybe it can't export .ply containing multiple frames.

These two pictures are different.

0 Kudos
York
Beginner
6,004 Views

So I think D435 can't shoot panorama point cloud(the whole room), or panorama requires manual synthesis, right?

0 Kudos
MartyG
Honored Contributor III
6,004 Views

I will let Alexandra continue with the ply question when she is back on the forum, as I do not have any information to add about that.

Regarding D435's viewpoint ... though the D435 has a wide field of view (FOV), you would have to either arrange multiple cameras around the room or walk a single camera around the room to capture all of it.

In a "volumetric capture" demo Intel did with D435s in January 2018, four cameras were used to capture a 180 degree view. It was estimated that eight would be needed in that setup for 360 degrees (though the company Jaunt managed a 360 degree view with six cameras).

https://realsense.intel.com/intel-realsense-volumetric-capture/ Volumetric Capture @ Sundance using Intel RealSense Depth Cameras

0 Kudos
York
Beginner
6,004 Views

Thank you very much.

Now I have some clarity about this.

In this way, if I need a .ply include the whole room point cloud, like a whole scene of ScanNet-data, I need to synthesize one by one frame by myself.

It should be so.

0 Kudos
Reply