How can I check specific point coordinates in PCLVisualizer? There are no information regarding this topic in help:
| Help:
-------
p, P : switch to a point-based representation
w, W : switch to a wireframe-based representation (where available)
s, S : switch to a surface-based representation (where available)
j, J : take a .PNG snapshot of the current window view
c, C : display current camera/window parameters
f, F : fly to point mode
e, E : exit the interactor
q, Q : stop and call VTK's TerminateApp
+/- : increment/decrement overall point size
+/- [+ ALT] : zoom in/out
g, G : display scale grid (on/off)
u, U : display lookup table (on/off)
r, R [+ ALT] : reset camera [to viewpoint = {0, 0, 0} -> center_{x, y, z}]
ALT + s, S : turn stereo mode on/off
ALT + f, F : switch between maximized window mode and original size
l, L : list all available geometric and color handlers for the current actor map
ALT + 0..9 [+ CTRL] : switch between different geometric handlers (where available)
0..9 [+ CTRL] : switch between different color handlers (where available)
SHIFT + left click : select a point
x, X : toggle rubber band selection mode for left mouse button
Does camera/window parameters
contain such information? When I press c
I get following output:
0.104105,104.105/-2.05844,1.35894,132.23/-0.65883,-6.36161,134.911/0.252413,0.357973,0.898968/0.523599/640,512/0,52
You have to capture the point picking event.
First create the point picking callback:
void pp_callback(const pcl::visualization::PointPickingEvent& event, void* viewer_void)
{
std::cout << "Picking event active" << std::endl;
if(event.getPointIndex()!=-1)
{
float x,y,z;
event.getPoint(x,y,z);
std::cout << x<< ";" << y<<";" << z << std::endl;
}
}
and then, in your code, tell the PCLvisualizer to use it:
pcl::visualization::PCLVisualizer visualizer("PCL visualizer");
[...]
visualizer.registerPointPickingCallback(pp_callback, (void*)&visualizer);
[...]
visualizer.spin ();
来源:https://stackoverflow.com/questions/26699427/checking-point-coordinates-in-pclvisualizer