Vuser_146uS6rN6k6l1
2025-06-12 16:25
RGB-D相机

如何使深度图转点云尺寸等于理论值

MV-DLS1400P 
4000 × 3000@RGB图
1920 × 1456@深度图

使用下面代码转换后点云图像也是4000*3000(处理太耗时间),如何得到1920 × 1456的点云图像(RGB对齐)


if(ImageType_Depth == stFrameData.stImageData[i].enImageType)
{
    MV3D_RGBD_IMAGE_DATA stPointCloudImage = {};
    int nRet = MV3D_RGBD_MapDepthToPointCloud(m_handle, &stFrameData.stImageData[i], &stPointCloudImage);
    if (MV3D_RGBD_OK != nRet) break;
    convertToPCL(stPointCloudImage, *cloud);
}


//Hiviwer 中实例代码

void convertToPCL(const MV3D_RGBD_IMAGE_DATA& stPointCloud, pcl::PointCloud<pcl::PointXYZ>& pclPointCloud)
{
pcl::PCLPointCloud2 pclCloud2;
pclCloud2.height = stPointCloud.nHeight;
pclCloud2.width = stPointCloud.nWidth;
pclCloud2.point_step = sizeof(POINT_XYZ);
pclCloud2.row_step = sizeof(POINT_XYZ) * stPointCloud.nWidth;

pclCloud2.fields.reserve(3);
pclCloud2.fields.push_back(createPointField("x", offsetof(POINT_XYZ, fX), pcl::PCLPointField::PointFieldTypes::FLOAT32, 1));
pclCloud2.fields.push_back(createPointField("y", offsetof(POINT_XYZ, fY), pcl::PCLPointField::PointFieldTypes::FLOAT32, 1));
pclCloud2.fields.push_back(createPointField("z", offsetof(POINT_XYZ, fZ), pcl::PCLPointField::PointFieldTypes::FLOAT32, 1));

pclCloud2.data.resize(pclCloud2.row_step * stPointCloud.nHeight);
memcpy(pclCloud2.data.data(), stPointCloud.pData, stPointCloud.nDataLen);
pcl::fromPCLPointCloud2(pclCloud2, pclPointCloud);
return;
}


HiCalibrator版本:V2.3.4 算法版本V1.9.0
显示的深度图像是1920*1456

HiViewer 版本V1.0.3 RGBD SDK 1.4.0
界面显示和保存的ply文件中都有4000*3000=1200w个点

2025-06-12 17:17发布追问
  • 18
  • 1
  • 分享

暂无回答

请升级浏览器版本

您正在使用的浏览器版本过低,请升级最新版本以获得更好的体验。

推荐使用以下浏览器