Segmentation Faut: 11 when loading .obj and .pcd files

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Segmentation Faut: 11 when loading .obj and .pcd files

nigellima
Hi, everyone.

I've just installed PCL on my macbook retina with the following specs:

4gb RAM.
2.4 GHz Core i5
Intel Iris 1236 MB
macOS Sierra 10.12.6

I tried the first example of wiriting a pcd file and it worked perfectly.
However, when I tried the code example for loading a file I get segmentation
fault: 11. The first model I tried was an obj file generated by a Google
Tango device, which was a full person scanned. After, I tried with a simple
box obj example and the segmentation fault didnt happen, but nothing was
shown on the visualizer.
The code is this one:

#include <pcl/common/common.h>
#include <pcl/io/obj_io.h>
#include <pcl/io/vtk_lib_io.h>
#include <pcl/visualization/pcl_visualizer.h>
int main()
{
  pcl::TextureMesh mesh7;
  pcl::io::loadOBJFile("vup.obj", mesh7);
  pcl::visualization::PCLVisualizer viewer_pre7("PCL Viewer_pre7");
  viewer_pre7.addTextureMesh(mesh7, "texture", 0);
  viewer_pre7.spin();
  return 0;
}

 Does anyone have any clue of what might be wrong? I appreciate any help.
Thanks in advance



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Segmentation Faut: 11 when loading .obj and .pcd files

nigellima
it seemed that the problem was regarding to cloud_viewer.h functions. I tried
another alternative using pcl_visualizer but some of the functions were also
causing segmentation fault. The following code worked to read and visualize
the obj file, but only as a point cloud data:


int main (int argc, char** argv)
{
  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new
pcl::PointCloud<pcl::PointXYZ>);

  if (pcl::io::loadOBJFile<pcl::PointXYZ> ("kelson.obj", *cloud) == -1) //*
load the file
  {
    PCL_ERROR ("Couldn't read file test_pcd.pcd \n");
    return (-1);
  }
  std::cout << "Loaded "
            << cloud->width * cloud->height
            << " data points from test_pcd.pcd with the following fields: "
            << std::endl;
  const std::string windowsName = "Simple Cloud Viewer";

  boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer (new
pcl::visualization::PCLVisualizer ("3D Viewer"));
  viewer->setBackgroundColor (0, 0, 0);
  viewer->addPointCloud<pcl::PointXYZ> (cloud, "sample cloud");
  viewer->setPointCloudRenderingProperties
(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "sample cloud");
  // viewer->addCoordinateSystem (1.0); This line was also causing
segmentation fault on Mac OS Sierra
  viewer->initCameraParameters ();

  while (!viewer->wasStopped ())
  {
    viewer->spinOnce (100);
    boost::this_thread::sleep (boost::posix_time::microseconds (100000));
  }
  return (0);
}



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users