【问题标题】:How to import .ply files using PCL io::loadPLYFile?如何使用 PCL io::loadPLYFile 导入 .ply 文件?
【发布时间】:2019-02-18 14:01:47
【问题描述】:

将 ply 文件导入我的程序时,我收到一条错误消息,指出以下消息出现问题:

C:\Users\...\data\apple.ply:8: property 'list uint8 int32 vertex_indices' of element 'face' is not handled

我使用了来自https://people.sc.fsu.edu/~jburkardt/data/ply/apple.ply的示例层文件

我已经尝试过来自不同来源的不同层文件,但它们都不起作用。调试程序时,io::loadPLYFile 不会生成有效的点云。 PCL 和我的程序的运行时库是相同的。

#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h>
#include <pcl/point_types.h>
#include <pcl/search/kdtree.h>
#include <pcl/features/normal_3d_omp.h>
#include <pcl/surface/marching_cubes_rbf.h>

using namespace pcl;
using namespace std;

int
  main (int argc, char** argv)
 {
  PointCloud<PointXYZ>::Ptr cloud (new PointCloud<PointXYZ>);
  std::cout << "Start Debug?" << std::endl;
  std::cin.ignore();

  if(io::loadPLYFile<PointXYZ> (argv[1], *cloud) == -1){
    cout << "ERROR: couldn't find file" << endl;
    return (1);
  } else {
    cout << "loaded" << endl;

    NormalEstimationOMP<PointXYZ, Normal> ne;
    search::KdTree<PointXYZ>::Ptr tree1 (new search::KdTree<PointXYZ>);
    tree1->setInputCloud (cloud);
    ne.setInputCloud (cloud);
    ne.setSearchMethod (tree1);
    ne.setKSearch (20);
    PointCloud<Normal>::Ptr normals (new PointCloud<Normal>);
    ne.compute (*normals);

我希望 PCL 函数 io::loadPLYFile 能够按照文档 http://docs.pointclouds.org/1.3.1/group__io.html 中的描述正确加载文件

【问题讨论】:

  • AFAIK 您看到的消息只是一个警告,因为 vertices 字段未读入 PointXYZ 字段。 XYZ 应该仍然可以正常加载。您是否尝试在阅读后保存文件?也许这将是了解您的 .ply 文件是否被正确读取的开始。
  • 感谢您的建议。你说得对,这只是一个警告。我认为这是一个错误,因为我的程序立即崩溃了。今天我意识到我的程序崩溃的原因一定是别的。它在发布模式下完美运行,但每次我在调试时崩溃,错误消息显示分配错误。它在“ne.compute (*normals);”时崩溃被执行。你知道我能做些什么吗?
  • 请发布您收到的完整错误消息以及您正在执行的完整代码。我猜不出“错误消息说分配错误”是怎么回事。
  • @kanstar 抱歉回复晚了。我应该将问题标记为已解决。正如我在下面的答案中所写,我在访问内存时遇到了分配错误。事实证明,Visual Studio 总是与 pcl::NormalEstimationOMP 的发布版本相关联,这就是它在调试模式下崩溃的原因。感谢您的支持,我收到的消息只是一个警告 - 这就是我开始寻找其他问题的原因

标签: import point-cloud-library marching-cubes ply-file-format


【解决方案1】:

控制台输出只是@kanstar 已经建议的警告!它很容易被忽略。我的程序在 Debug 中崩溃但在 Release 中没有崩溃的原因是我的 Visual Studio 链接到了错误的 boost 库版本,这导致了崩溃。修复链接使 pcl::NormalEstimationOMP 按预期工作。

【讨论】:

    猜你喜欢
    • 2015-08-26
    • 1970-01-01
    • 2021-08-31
    • 2015-06-26
    • 1970-01-01
    • 2020-11-26
    • 2013-11-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多