Point Cloud Library - Converting between PointT and PointXYZ

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

Point Cloud Library - Converting between PointT and PointXYZ

zamzam
I have compiled and run this https://github.com/otherlab/pcl/blob/master/apps/src/openni_ii_normal_estimation.cpp

However I now want to be able to access the underlying raw information about (i) the normals in ne_ and also the x,y,z points store in the PointCloud of type <PointT>. I cannot seem to extract raw information (x,y,z positions for example) from the CloudConstPtr (that's pcl::PointCloud::ConstPtr). I have tried casting to new PointCloud objects of type PointXYZ but I get errors saying that it cannot. Can somebody please demonstrate how to extract xyz information... it should be easy.

My thinking is, that because at compile time, I point to an object PointCloud of generic type of PointT, I need to "transform" this into a PointXYZ type, to be able to access to specific PointXYZ type members. The problem is that I don't know how to do this "transformation"

Literally, taking my cloud_cb(CloudConstPtr &cloud) function. I want to be able to do something like grab the 1st element's x coordinate in the PointCloud i.e. cloud->data[0]->x

Many Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Point Cloud Library - Converting between PointT and PointXYZ

aichim
Administrator
Hi,

Please make sure you have a thorough understanding of how C++ templates work.

Cheers,
Alex

On May 1, 2013, at 11:05 AM, zamzam <[hidden email]> wrote:

> I have compiled and run this
> https://github.com/otherlab/pcl/blob/master/apps/src/openni_ii_normal_estimation.cpp
>
> However I now want to be able to access the underlying raw information about
> (i) the normals in ne_ and also the x,y,z points store in the PointCloud of
> type <PointT>. I cannot seem to extract raw information (x,y,z positions for
> example) from the CloudConstPtr (that's pcl::PointCloud::ConstPtr). I have
> tried casting to new PointCloud objects of type PointXYZ but I get errors
> saying that it cannot. Can somebody please demonstrate how to extract xyz
> information... it should be easy.
>
> My thinking is, that because at compile time, I point to an object
> PointCloud of generic type of PointT, I need to "transform" this into a
> PointXYZ type, to be able to access to specific PointXYZ type members. The
> problem is that I don't know how to do this "transformation"
>
> Literally, taking my cloud_cb(CloudConstPtr &cloud) function. I want to be
> able to do something like grab the 1st element's x coordinate in the
> PointCloud i.e. cloud->data[0]->x
>
> Many Thanks
>
>
>
> --
> View this message in context: http://www.pcl-users.org/Point-Cloud-Library-Converting-between-PointT-and-PointXYZ-tp4027616.html
> Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Point Cloud Library - Converting between PointT and PointXYZ

zamzam
OK, I have an understanding, albeit perhaps not thorough on how templates work (I have written template classes). Would you be willing to drop a hint about how I achieve what my original post asks? The hint may help my understanding of templates.