简体   繁体   English

如何导出PointCloud以在Matlab中查看

[英]How to export a pointcloud to be view in matlab

I use the OpenCV function 我使用OpenCV功能

pointCloud = cv2.reprojectImageTo3D(filteredImg,disparityToDepthMap) / 420

to get an pointcloud of my stereo images. 得到我的立体图像的点云。

I want to show it into matlab, I tried to load the data into matlab but i failed. 我想将其显示到matlab中,我尝试将数据加载到matlab中,但失败了。

In order to save variables to be read later in Matlab, I recommend to store them as .mat documents executing the following line in python: 为了保存变量以便以后在Matlab中读取,我建议将它们存储为.mat文档,并在python中执行以下行:

import scipy.io as spio

spio.savemat(r'C:\DirectoryNameofMatlabProject' , mdict={'namedata': namedata})

Once stored the .mat containing the desired data, in your case "pointCloud", you will need to open the .mat in Matlab. 一旦存储了包含所需数据的.mat(在您的情况下为“ pointCloud”),则需要在Matlab中打开.mat。 For this, just click in "Import Data". 为此,只需单击“导入数据”。

Finally, in order to transform this data into a pointCloud object in Matlab, execute the following code: 最后,为了将此数据转换为Matlab中的pointCloud对象,请执行以下代码:

ptCloud=pointCloud(namedata);

pcshow(namedata)

I hope you find it helpful. 我希望你觉得这对你有帮助。

Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM