How do I save a pcd file?

Hi,

I have exported Depth Image and Aligned Color Image using RecFusionPro.
00_colorAligned_0000
00_depth_0000
I have segmented the exported images for foreground and background, and I would like to convert the processed foreground image into a pcd point cloud file.
00_colorAligned_0000_mask
m_00_depth_0000
I have done the conversion using open3d, here is the code for the processing, but the results are very different from the RecFusionPro export.
I would appreciate some guidance on this, thank you very much.

color_raw = o3d.io.read_image(f'00_colorAligned_0000_mask.png')
depth_raw = o3d.io.read_image(f'm_00_depth_0000.png')
rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(color_raw, depth_raw, depth_scale=1000,
                                                                depth_trunc=50,
                                                                convert_rgb_to_intensity=False)
depth_intrinsic = o3d.camera.PinholeCameraIntrinsic(640,
                                                  480,
                                                  fx=387.5287,     
                                                  fy=387.5287,    
                                                  cx=321.6345,     
                                                  cy=238.4719, )   
pcd = o3d.geometry.PointCloud.create_from_rgbd_image(rgbd_image, depth_intrinsic)
o3d.io.write_point_cloud('e:/test_0.pcd', pcd)
1 Like

How does RecFusionPro save pcd point cloud files please?
I noticed that RecFusion SDK doesn’t have the ability to export point clouds either
This feature is very useful for working with data offline, any help is appreciated!

Your Open3D code looks correct, assuming that the provided intrinsics are the ones of the depth camera.
To save the point cloud with the tracked pose you need to transform the point cloud with the trackedT matrix provided by Reconstruction::addFrame

Thank you very much for your prompt reply!
This is the camera’s intrinsics and extrinsic parameters stored in the rfms file:

	<param name="format">1</param>
	<property name="Sensor">
		<param name="index">0</param>
		<param name="T">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 </param>
		<param name="depthK">387.528778076172 0 321.634582519531 0 387.528778076172 238.471908569336 0 0 1 </param>
		<param name="colorK">606.873718261719 0 314.763122558594 0 606.261291503906 249.718032836914 0 0 1 </param>
		<param name="depthToColorT">0.99994957447052 0.00980688631534576 0.00216187001205981 14.6871042251587 -0.00980737060308456 0.999951899051666 0.000213436855119653 0.139858424663544 -0.00215967278927565 -0.000234628343605436 0.999997615814209 0.183469504117966 0 0 0 1 </param>
	</property>

Hi,
This is the raw data mentioned above, could you please help me with it? I’ve been stuck here for days, thanks a lot!

I found the reason. It’s the Units of Depth image are assumed to be 0.1 mm in RecFusion.
Thank you for your reply.