PCL 1.8. 1
1. 1 contains the header file.
# Including
# Including
# Including
# Including
Use namespace pcl
typedef PCL::point XYZ PointT;
typedef PCL::point cloud point cloud t;
//Mutex://Process lock
Boost:: mutually exclusive cloud _ mutex
//Used to define the structure of the callback function.
Structure Callback _ Parameter
{
point cloudt::Ptr clicked _ points _ 3d;
PCL::visualization::PCLVisualizer::Ptr viewer Ptr;
};
//Callback function
//Hold down shift, right-click the point cloud, and the point distance will be displayed.
void PP _ callback(const PCL::visualization::PointPickingEvent & amp; Event, void * args)
{
Struct callback _args * data = (struct callback _ args *)args;;
If (event). getPointIndex() == - 1)
Return;
PointT current point;
Events. getPoint(current_point.x,current_point.y,current _ point . z);
//TODO
Data-> clicked _ points _ 3d-& gt; clear(); //Empty the last selected point.
Data-> clicked _ points _ 3d-& gt; Points.push_back (current point); //Add a newly selected point
//Draw the clicked point in red: mark the selected point in red.
PCL::visualization::PointCloudColorHandlerCustom red(data-& gt; clicked_points_3d,255,0,0);
Data-> viewer ptr-& gt; removePointCloud(" clicked _ points ");
Data-> viewer ptr-& gt; addPointCloud(data-& gt; Clicked_points_3d, red, "clicked _ points");
Data-> viewer ptr-& gt; setPointCloudRenderingProperties(PCL::visualization::PCL _ VISUALIZER _ POINT _ SIZE, 10," clicked _ points ");
Standard:: cout