【发布时间】:2020-06-12 14:20:33
【问题描述】:
我正在尝试从点云创建 3D CImg 对象以使用 CImg 的编辑功能。
我有一个点云,我以 ascii 格式保存
pcl::io::savePCDFileASCII("/path/data.txt", *cloud);
然后我初始化一个 3d CImg 对象并尝试加载 asci 文件
CImg<float> image(cloud->width, cloud->height, 5);
image.load_ascii("/path/data.txt");
这是错误
[CImg] *** CImgIOException *** [instance(512,432,5,1,0x55555668f800,non-shared)] CImg<float>::load_ascii(): Invalid ascii header in file '/path/data.txt', image dimensions are set to (0,1,1,1).
terminate called after throwing an instance of 'cimg_library::CImgIOException'
what(): [instance(512,432,5,1,0x55555668f800,non-shared)] CImg<float>::load_ascii(): Invalid ascii header in file '/path/data.txt', image dimensions are set to (0,1,1,1).
这是我生成的 ascii 文件
# .PCD v0.7 - Point Cloud Data file format
VERSION 0.7
FIELDS x y z rgb
SIZE 4 4 4 4
TYPE F F F U
COUNT 1 1 1 1
WIDTH 512
HEIGHT 432
VIEWPOINT 0 0 0 1 0 0 0
POINTS 221184
DATA ascii
-0.2196694 -0.1688118 0.55800003 4285428082
-0.21879199 -0.1688118 0.55800003 4285559668
...
我是 c++ 和 CImg 的新手,所以我不确定将点云加载到 CImg 中的正确或最佳方式是什么。我在互联网上也找不到任何有用的东西,而且 CImg github 造成的混乱比它的帮助更多。
我正在使用 Ubuntu 20、c++ 11 并且加载任何类型的 2D 图像都可以正常工作。
【问题讨论】:
-
快速查看源代码表明文件应以 WIDTH HEIGHT DEPTH NUMCHANNELS 开头,后跟数据。
标签: c++ point-cloud-library cimg