1 | initial version |
if you look at the ply loader code , it should be quite simple to supply your own data in the same format:
(pseudo) code:
// without normals:
Mat cloud(num3dPoints, 3, CV_32F);
for (int row=0; row<num3dPoints; row++)
{
x,y,z = points3d[row];
cloud.at<float>(row, 0) = x;
cloud.at<float>(row, 1) = y;
cloud.at<float>(row, 2) = z;
}
// or, with normals:
Mat cloud(num3dPoints, 6, CV_32F);
for (int row=0; row<num3dPoints; row++)
{
x,y,z = points3d[row];
cloud.at<float>(row, 0) = x;
cloud.at<float>(row, 1) = y;
cloud.at<float>(row, 2) = z;
nx,ny,nz = normals[row];
float length = sqrt(nx*nx + ny*ny + nz*nz);
cloud.at<float>(row, 3) = nx/length;
cloud.at<float>(row, 4) = ny/length;
cloud.at<float>(row, 5) = nz/length;
}