randomcode
randomcode

Reputation: 23

How to import .ply files using PCL io::loadPLYFile?

When importing a ply-file into my program I get an Error-message saying that something went wrong with the following message:

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

I used a sample ply file from: https://people.sc.fsu.edu/~jburkardt/data/ply/apple.ply

I have already tried different ply files from different sources but none of them work. When debugging the program the io::loadPLYFile doesn't generate a valid pointcloud. Runtime Library for PCL and for my program are the same.

#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);

I would expect the PCL function io::loadPLYFile to load the files properly as described in the documentation http://docs.pointclouds.org/1.3.1/group__io.html

Upvotes: 0

Views: 3232

Answers (1)

randomcode
randomcode

Reputation: 23

the console output is just a warning as @kanstar already suggested! It can easily be ignored. The reason my program crashed in Debug but not in Release was that my Visual Studio linked to the wrong library version of boost which resulted in the crash. Fixing the linkage made the pcl::NormalEstimationOMP work as expected.

Upvotes: 2

Related Questions