Convert from pcl::PointNormal to pcl::Normal

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

Convert from pcl::PointNormal to pcl::Normal

Jue_KA
This post was updated on .
Hello everyone,

I have a problem by converting the pcl::PointNormal to pcl::Normal.

Here is my code:

  pcl::PointCloud<pcl::Normal>::Ptr cloud_norm (new pcl::PointCloud<pcl::Normal>);
  pcl::copyPointCloud<pcl::PointNormal, pcl::Normal>(*cloud_normals,*cloud_norm);

But this didnt't work.

I have the idea of copying the values directly but I dont know how to access
them.
Here is my idea as code:

  for(size_t i = 0; i<cloud_normals->points.size(); ++i)
  {
    cloud_norm->normal[i].x = cloud_normals->normal[i].x;
    cloud_norm->normal[i].y = cloud_normals->normal[i].y;
    cloud_norm->normal[i].z = cloud_normals->normal[i].z;
  }


Any help is appreciated.



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

Re: Convert from pcl::PointNormal to pcl::Normal

Jue_KA
This post was updated on .
So, I figuered the members of the two clods out. Here is what I got:

  for(size_t i = 0; i<cloud_normals->points.size(); ++i)
  {
    cloud_norm->points[i].normal_x = cloud_normals->points[i].normal_x;
    cloud_norm->points[i].normal_y = cloud_normals->points[i].normal_y;
    cloud_norm->points[i].normal_z = cloud_normals->points[i].normal_z;

  }

now I get the error: "Segmentation fault (core dumped)" I guess it's the
running index of the for-loop.

I'm new to pcl and cpp so I think the fault is not so big.

Thanks in advance!





--
Sent from: http://www.pcl-users.org/
_______________________________________________
PCL-users@pointclouds.org / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users