c-sommer / orthogonal-planes

Code accompanying the paper "From Planes to Corners: Multi-Purpose Primitive Detection in Unorganized 3D Point Clouds" by C. Sommer, Y. Sun, L. Guibas, D. Cremers and T. Birdal.
https://doi.org/10.1109/LRA.2020.2969936
BSD 3-Clause "New" or "Revised" License
81 stars 26 forks source link

How to generate the ply file like the example? #5

Open navrobot opened 2 years ago

navrobot commented 2 years ago

Could you please provide your code snippet?

c-sommer commented 2 years ago

Could you elaborate what exactly you mean? The example .ply is provided in data/test_single.ply. To obtain this point cloud, we converted the depth data to a 3D point cloud using the pinhole model with intrinsics provided by the ICL NUIM dataset. In Matlab, the code for this would be

% D is the depth image
[n,m] = meshgrid(1:size(D,2),1:size(D,1));
idx = (D>0)&(D<inf);

% fx, fy are focal length, ux, uy principle point coordinates
x = D.*(n-ux-1)/fx;
y = D.*(m-uy-1)/fy;
z = D;

pc = pointCloud([x(idx),y(idx),z(idx)]);

To subsample, we used code that is not open sourced, following reference [47] from the paper (Birdal and Ilic, A point sampling algorithm for 3D matching of irregular geometries, IROS 2017). Matlab's pcdownsample with option gridAverage will produce similar results.