MV3D_RGBD_IMAGE_DATA stPointCloudImage = new MV3D_RGBD_IMAGE_DATA();
int nRet3d = (int)Mv3dRgbdSDK.MV3D_RGBD_OK;
nRet3d = Mv3dRgbdSDK.MV3D_RGBD_MapDepthToPointCloud(m_handle, stFrameData.stImageData[0], stPointCloudImage);
if (Mv3dRgbdSDK.MV3D_RGBD_OK != nRet3d)
{
// Console.WriteLine("MV3D_RGBD_MapDepthToPointCloud_NET Fail!");
return;
}
int nPointNum = (int)stPointCloudImage.nDataLen / (sizeof(float) * 3);
float[] vecX = new float[nPointNum];
float[] vecY = new float[nPointNum];
float[] vecZ = new float[nPointNum];
if (m_MaxImageSize < stPointCloudImage.nDataLen)
{
pValue = new byte[stPointCloudImage.nDataLen];
}
Marshal.Copy(stPointCloudImage.pData, pValue, 0, (int)stPointCloudImage.nDataLen);
for (int nPntIndex = 0; nPntIndex < nPointNum; ++nPntIndex)
{
vecX[nPntIndex] = pValue[nPntIndex * 3 + 0];
vecY[nPntIndex] = pValue[nPntIndex * 3 + 1];
vecZ[nPntIndex] = pValue[nPntIndex * 3 + 2];
//wr.WriteLine(Convert.ToString(vecX[nPntIndex]) + "\t" + Convert.ToString(vecY[nPntIndex]) + "\t" + Convert.ToString(vecY[nPntIndex]));
}
C#中使用以上代码对点云图解析,但是提取出的XYZ不对
在C++中使用以上方法可以解析,C#中得到的值基本都小于255,像是彩色图
探寻机器视觉新星|第二届“启智杯”机器视觉设计大赛获奖名单公布
2024-04-08 16:39:23