Export a 3d cloud from a single frame

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Export a 3d cloud from a single frame

DorEdel
Hi!

I have a DB full of data and I need to get a .ply file of a single frame from the DB ( if I wasn't clear I want a 3d model of the image and not a grey scale of the image's depth)

Can I do it with rtabmap?
and if I can't is there a third party app that can do it?

Thanks in advance :-)
Reply | Threaded
Open this post in threaded view
|

Re: Export a 3d cloud from a single frame

matlabbe
Administrator
Hi,

you can open the database in rtabmap. Click on File->"Export 3D clouds..." and uncheck "Assemble clouds". This will save all frames separately. If you want to export only one frame, open View->MapVisibility, check/uncheck "Select all" to hide all clouds, then only click on the one you want to see. Then if you go back to File->"Export 3D clouds...", only that frame will be exported.

Another way is to export to RGB/depth image files (File->Export Images, export rgb as PNG) and to use "pcl_png2pcd" tool installed with PCL. Note that PCL version on indigo is too old, but in recent PCL version you can do this:
$ pcl_png2pcd rgb.png depth.png test.pcd

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: Export a 3d cloud from a single frame

DorEdel
I've tried both suggestions and they both don't work with the frame I want...

this is the frame I want (it was taken by R200)
rgb:

depth:


I want one of the frames between 120 to 240 but it gives me and option to see only frames 680-ish to 702 (the last frame)
when I tried to use the png2pcd with the wanted frame the data in the pcd showed nan on the x y z coordinates

Is there another option? or the frame is just too mush messed up?

thank you!
Reply | Threaded
Open this post in threaded view
|

Re: Export a 3d cloud from a single frame

matlabbe
Administrator
This post was updated on .
Hi,

Having multiple sessions not connected is a little more tricky but possible. Following this post: http://official-rtab-map-forum.206.s1.nabble.com/Exporting-multiple-session-maps-tp2157p2187.html, you can export clouds of the selected session. In your case, under the Graph View, set "Optimize from" to a value between 120 and 240. Click File->Export 3D Map, then make sure you answer No to "Do you want to assemble...". This will save all frames separately (multiple PCD files).

The PCD files would be organized, so including NaN values for invalid pixels in the depth image. To convert to PLY, do this to remove the NaN values:
$ pcl_passthrough_filter node1.pcd output1.pcd -min -9999999 -max 9999999 -keep 0
$ pcl_pcd2ply output1.pcd node1.ply

Note that you can also do in Database Viewer: File->Extract Images, to extract all RGB and depth images from all sessions at once. Make sure to use PNG for RGB images than you will be able to use PCL tools as mentioned in my previous post to reconstruct the cloud.

cheers,
Mathieu