将点云从毫米转换为米
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().
首先,我们加载一个点云。
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();
然后我们创建一个0.001缩放比例的4x4变换矩阵。
我们使用这个变换矩阵进行点云转换。
最后,保存转换后的点云。
const auto transformedFile = "FrameInMeters.zdf";
std::cout << "Saving transformed point cloud to file: " << transformedFile << std::endl;
frame.save(transformedFile);