0

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

randomcode
  • 23
  • 1
  • 5
  • AFAIK the message you are seeing is just a warning, since the *vertices* field is not read into the *PointXYZ* field. The *XYZ* should be still loaded fine. Have you tried saving the file after reading it? Maybe that would be a start to know if your .ply file is read correctly or not. – serkan.tuerker Feb 18 '19 at 19:12
  • Thanks for the advice. You were right that it's only a warning. I thought this is an error because my program crashed immediately. Today I realized the reason for my program crashing has to be something else. It works perfectly when in Release mode but crashes every time I am in Debug with the error message saying bad allocation. It crashes when the "ne.compute (*normals);" is executed. Do you have any idea what I can do about that? – randomcode Feb 19 '19 at 16:52
  • Please post the complete error message your are getting and also the complete code you are executing. I can't guess what's going on with "error message saying bad allocation." – serkan.tuerker Feb 20 '19 at 23:46
  • 1
    @kanstar sorry for the late reply. I should have marked the question as solved. As I wrote in the answer below I was getting allocation errors when accessing the memory. It turned out that Visual Studio always linked against the Release Version of the pcl::NormalEstimationOMP and thats why it crashed in Debug mode. Thank you for your support that the message I was getting is only a warning - thats why I started to look for other issues – randomcode Feb 28 '19 at 07:11

1 Answers1

2

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.

randomcode
  • 23
  • 1
  • 5