void StereoMatch::savePointClouds(cv::Mat& pointClouds, const char* filename) //pointclouds 是点云
{
int i=0;
const double max_z = 1.0e4;
for(int y = 0; y < pointClouds.rows; y++)//随机点云要计算真是点数
{
for(int x = 0; x < pointClouds.cols; x++)
{
cv::Vec3f point = pointClouds.at<cv::Vec3f>(y, x);
if(fabs(point[2] - max_z) < FLT_EPSILON || fabs(point[2]) > max_z) continue;
i++;
}
}
try
{
FILE* fp = fopen(filename, "wt");
fprintf(fp,"# .PCD v0.7 - Point Cloud Data file format\n");
fprintf(fp,"VERSION 0.7\n");
fprintf(fp,"FIELDS x y z\n");
fprintf(fp,"SIZE 4 4 4\n");
fprintf(fp,"TYPE F F F\n");
OpenCV Reprojecto3D 后 点云生成PCD格式
最新推荐文章于 2025-06-18 21:17:25 发布