Pergunta

A tool I'm working on is crashing somewhere deep in boost. In the debugger I've noticed, that too many cloud-points have nan as value. I've tried to dump the file using the code below (from a PCL tutorial) and got the output like this:

...
nan nan nan
nan nan nan
nan nan nan
nan nan nan
...

Is it correct? Is the file corrupt? Is my reading routine not appropriate for the file?

I'm using pcl-1.7. Blow is the code for dumping the file.

Thank you for any advice!

//s. http://pointclouds.org/documentation/tutorials/reading_pcd.php    
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>

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

  if (pcl::io::loadPCDFile<pcl::PointXYZ> (argv[1], *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;
  for (size_t i = 0; i < cloud->points.size (); ++i)
    std::cout << "    " << cloud->points[i].x
              << " "    << cloud->points[i].y
              << " "    << cloud->points[i].z << std::endl;

  return (0);
}
Foi útil?

Solução

Having a lot of NaNs inside a point cloud is not usually a problem: NaN values indicate space locations where the sensor had troubles detecting depth values. It could happen on oddly reflecting surfaces (i.e. metal), surfaces too far away or in areas which are occluded (shadows).

Outras dicas

In pcl, some functions simply ignore Nan points, and you do not have to be worried about them. But when you are doing some tasks, for example "Normal estimation" you might come to an unexpected error "Invalid Data", and then you have to remove NaN from your cloud using [pcl::removeNaNFromPointCloud]

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top