Transform Point Cloud from Millimeters to Meters
To convert a point cloud from millimeters to meters, build a 4x4 homogeneous transformation matrix with 0.001 scaling on the diagonal and apply it with PointCloud::transform().
First, we load a point cloud.
const auto dataFile = std::string(ZIVID_SAMPLE_DATA_DIR) + "/CalibrationBoardInCameraOrigin.zdf";
std::cout << "Reading " << dataFile << " point cloud" << std::endl;
auto frame = Zivid::Frame(dataFile);
auto pointCloud = frame.pointCloud();
We then create a 4x4 transformation matrix with 0.001 scaling.
Then, we transform the point cloud using this transformation matrix.
Finally, save the transformed point cloud.
const auto transformedFile = "FrameInMeters.zdf";
std::cout << "Saving transformed point cloud to file: " << transformedFile << std::endl;
frame.save(transformedFile);