how to get coordinate from bounding box

asked 2015-09-14 00:55:38 -0600

Karz gravatar image

updated 2015-09-17 09:02:14 -0600

I need to get information about real time coordinates of mobile bounding box? So, the real time coordinates can be showed up in terminals or published to topics.

Here is my snippet code to draw bounding box from PCL:

 while (!viewer.wasStopped())
  {
  if (new_cloud_available_flag && cloud_mutex.try_lock ())    // if a new cloud is available
    {
      new_cloud_available_flag = false;

  // Perform people detection on the new cloud:
  std::vector<pcl::people::PersonCluster<PointT> > clusters;   // vector containing persons clusters
  people_detector.setInputCloud(cloud);
  people_detector.setGround(ground_coeffs);                    // set floor coefficients
  people_detector.compute(clusters);                           // perform people detection

  ground_coeffs = people_detector.getGround();                 // get updated floor coefficients

  // Draw cloud and people bounding boxes in the viewer:
  viewer.removeAllPointClouds();
  viewer.removeAllShapes();
  pcl::visualization::PointCloudColorHandlerRGBField<PointT> rgb(cloud);
  viewer.addPointCloud<PointT> (cloud, rgb, "input_cloud");
  unsigned int k = 0;


  for(std::vector<pcl::people::PersonCluster<PointT> >::iterator it = clusters.begin(); it != clusters.end(); ++it)
  {
    if(it->getPersonConfidence() > min_confidence)             // draw only people with confidence above a threshold
    {
      // draw theoretical person bounding box in the PCL viewer:
      it->drawTBoundingBox(viewer, k);
      k++;
    }
  }
cout << k << " people found" << endl;

  viewer.spinOnce();

I need to display the bounding box in x,y,z coordinates (real time) or another parameters to set the robot forward, turn left or right. I think the x,y,z is much better, remember this node is always need to set the ground plane in early and weak parameter (no significant value whether bounding box is in the middle or not) although it is real time too.

when i try to use this code:

  for (size_t i = 0; i < 2; ++i)
std::cout << "    " << cloud->points[i].x
          << " "    << cloud->points[i].y
          << " "    << cloud->points[i].z << std::endl;

the node shows nan (maybe, no available number?) thank your for your helping :)

edit retag flag offensive close merge delete

Comments

I suggest adding information about how the bounding boxes are represented in your code.

Airuno2L gravatar image Airuno2L  ( 2015-09-14 11:07:48 -0600 )edit

thank you for your suggestion :)

Karz gravatar image Karz  ( 2015-09-22 22:29:04 -0600 )edit

http://docs.pointclouds.org/trunk/str... check this out when you get a chance. If you are still working on this haha. I'm have just now started looking at bounding boxes and will hopefully have more information soon.

MT gravatar image MT  ( 2017-10-30 08:56:03 -0600 )edit