Ask Your Question
0

Obtaining Point by using (column, row) coordinate.

asked 2016-07-05 01:18:33 -0600

dinesh gravatar image

updated 2016-07-05 02:45:04 -0600

How to use pcl::PointCloud<pcl::pointxyz> pcl data type to get the euclidian points x,y,z by using its member function: const PointT& pcl::PointCloud< PointT >::at(int column, int row) and to save in output object: pcl::PointCloud<pcl::pointxyz> output; tried so much but still didn't get how to get the real world cordinates of point cloud in pcl, if i could access the depth of point than by using the camera parameters i would have done but couln't get that also. i tried this: output.PointXYZ.p = input->const PointXYZ& pcl::PointCloud::at(34,43) to check wheather it will access pixel at (34,43) position, its no use.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-07-05 03:21:53 -0600

ahendrix gravatar image

updated 2016-07-05 03:24:14 -0600

This works for me:

void cloudCb(const sensor_msgs::PointCloud2ConstPtr & cloud) {
  pcl::PointCloud<pcl::PointXYZ> depth;
  pcl::fromROSMsg( *cloud, depth);
  int x = 0, y = 0; // set x and y
  pcl::PointXYZ p1 = depth.at(x, y);
}

That comes from a sample that uses the full ROS pointCloud2 data structure, but you should be able to do the same by subscribing to the pcl::PointCloud<pcl::PointXYZ> type.

Note that the PointCloud is already transformed into sensor-relative world coordinates; I don't need to perform any additional transformation or use the camera intrinsics to get XYZ data.

Perhaps if you described the problem better by posting the code that's giving you trouble, how you're running it, describing the desired results, and the actual results, we might be be able to provide more useful advice.

edit flag offensive delete link more

Comments

thank u for giving me proper solution for this problem, i was so worried for this problem but now i go it. thank u and u people are doing a beautiful work from their. really. next time ill try to describe the problem in more detail.

dinesh gravatar imagedinesh ( 2016-07-05 10:34:41 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-07-05 01:18:33 -0600

Seen: 922 times

Last updated: Jul 05 '16