Creating pointer to vector <int> for computing centroid

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

Creating pointer to vector <int> for computing centroid

Rupam_B
This post was updated on .
Hello everyone,
                      I have a vector which is populated by the indices of points ( given in indices.txt ) corresponding to a particular point cloud. I do not have access to the original point cloud.
                      I want to create a pointer of type i) pcl::ConstCloudIterator<PointT>&   OR ii) const pcl::PointCloud<PointT>&.
This type of pointers are required to use the method pcl::compute3DCentroid() given here.
                      I have tried with the following code snippet.

vector<int> indices;
std::vector<int>::iterator it;
boost::shared_ptr<vector<int> > indicesptr (new vector<int> (indices));
 for (size_t i = 0; i < int(indices.size()); i++){
                Eigen::Vector4f centroid;
        pcl::compute3DCentroid (*indicesptr, centroid);
                cout << centroid[0] << " " <<  centroid[1] << " " <<   centroid[2] << " " <<   centroid[3] << " \n";
 }
Error is:

error: no matching function for call to ‘compute3DCentroid(boost::shared_ptr<std::vector<int> >&, Eigen::Vector4f&)’

I have also tried in the following way:
std::vector <pcl::PointCloud<pcl::PointXYZ>::Ptr> indices;
pcl::PointCloud<pcl::PointXYZ>::Ptr indicesptr  (new vector <pcl::PointCloud<pcl::PointXYZ>::Ptr> (indices));

My question is how to create the specific pointers which points to the populated vector and utilize them in  the function: pcl::compute3DCentroid (*indicesptr, centroid);

Where am I doing wrong?

Thanks in advance for any kind of help.

 
Reply | Threaded
Open this post in threaded view
|

Re: Creating pointer to vector <int>

Sérgio Agostinho
Reply | Threaded
Open this post in threaded view
|

Re: Creating pointer to vector <int>

Rupam_B
This post was updated on .
Hi,
    Thank you for the provided information. I do not have access to the original point cloud data.
   
    Is it still possible to generate a (  pcl::PointCloud< PointT > & ) pointer to the input point cloud?

Best wishes,
RupamB

     
Reply | Threaded
Open this post in threaded view
|

Re: Creating pointer to vector <int>

Sérgio Agostinho
Without the the data from the point cloud you won’t be able to compute the centroid. If the objective is to have a method which computes the centroid given a point cloud and indices, then the method I’ve linked before is the way to go.

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

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Creating pointer to vector <int>

Rupam_B
Dear Sérgio,
                Thanks for your reply.
Suppose, I have a depth image in which a human and an object are present. Let us suppose that the
object indices that I am talking about corresponds to this depth image.

Is it possible to generate point cloud specific to the object from the depth image given the 4*4 transformation matrix?

Reply | Threaded
Open this post in threaded view
|

Re: Creating pointer to vector <int>

Sérgio Agostinho

> Suppose, I have a depth image in which a human and an object are present.
> Let us suppose that the
> object indices that I am talking about corresponds to this *depth image. *
>
> *Is it possible to *generate point cloud* specific to the object from the
> depth image given the 4*4 transformation matrix*?
This reasoning went bananas on the “4x4 transformation matrix”.

If you know  your depth camera intrinsic parameters you can generate a(n organized) point cloud from a depth image. If you know which pixels (depth image) correspond to the object in question, then you know which points of the point cloud also correspond to the object.

Cheers



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

smime.p7s (4K) Download Attachment