在 PCL 可视化工具中打印所选点的 3D 坐标
Print 3D coordinates of the selected point inside PCL visualizer
我正在尝试使用 PCL 打印所选点的 3D 坐标。下面是代码:
#include <iostream>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
#include <pcl/visualization/pcl_visualizer.h>
using namespace std;
void pointPickingEventOccurred (const pcl::visualization::PointPickingEvent& event, void* viewer_void)
{
std::cout << "[INOF] Point picking event occurred." << std::endl;
float x, y, z;
if (event.getPointIndex () == -1)
{
return;
}
event.getPoint(x, y, z);
std::cout << "[INOF] Point coordinate ( " << x << ", " << y << ", " << z << ")" << std::endl;
}
int main (int argc, char** argv)
{
pcl::visualization::PCLVisualizer viewer("Cloud Viewer");
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr body (new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::io::loadPCDFile ("body.pcd", *body);
viewer.addPointCloud (body,"body");
viewer.registerPointPickingCallback (pointPickingEventOccurred, (void*)&viewer);
viewer.spin();
return 0;
}
代码编译没有任何错误,但它不会以 termainal 打印任何信息。这是怎么回事?
尝试在左键单击的同时按住 shift 键以选取一个点。
相关文章:
- 重心坐标并不总是有效(3d)
- 从 CGAL 3D 网格生成中获取顶点坐标的 -6.27744e+66:mesh_implicit_sphere示例
- 如何从 3d 对象文件中获取 3d 坐标
- 在 PCL 可视化工具中打印所选点的 3D 坐标
- 用于将笛卡尔 (x,y,z) 转换为圆柱坐标 (ρ,θ,z) 坐标 2D/3D 的代码
- 从 3 个视点在 3 张图像上有 3 个点如何在 3D 空间中获取其坐标?
- c++ 从大型数组中读取 3D 坐标并计算它们之间的距离
- 获取具有X,Y和距离的OPENCV中的3D坐标
- OpenCV从2D像素获取3D坐标
- OpenGL从窗口点到3D坐标
- C 矩阵乘法 - 从深度图像中恢复3D坐标
- OpenCV立体视觉3D坐标到2D相机平面投影不同于将2D点三角化到3D
- 将 3D 坐标转换为 3ds 中的 2D 最大值
- 在 OpenGL 中将 3D 坐标转换为屏幕坐标
- 2D 坐标到 3D 坐标分辨率和相机矩阵
- 2d(3d)坐标的哈希映射(即双精度向量)
- 为openGL提供3D坐标的顺序是什么?
- 如何将屏幕上的鼠标坐标转换为3D坐标
- 在c++中修改3D坐标
- 从3D坐标转换到2D坐标的问题