使用PCL显示Azure Kinect采集到的点云
参考文章,大佬介绍的非常好。
我这里希望能显示并保存彩色点云并借此学习下SDK的基础使用,所以并不如上述参考文章周密复杂,只写了段简单简陋的代码。
键盘退出响应可能有些问题,其他功能性尚好。
代码如下
#include <k4a/k4a.hpp>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h>
#include <pcl/visualization/pcl_visualizer.h>
using namespace std;
using namespace pcl;
bool save_flag = false;
bool quit_flag = false;
void keyboard_event(const visualization::KeyboardEvent& event, void* nothing){
if(event.getKeySym() == "s" && event.keyDown()){
save_flag = true;
}else if(event.getKeySym() == "q" && event.keyDown()){
quit_flag = true;
}
}
void pcl_azure_kinect_display(){
uint32_t device_count = 0;
k4a::device device = NULL;
k4a_device_configuration_t config = K4A_DEVICE_CONFIG_INIT_DISABLE_ALL;
//get the number of connected devices
device_count = k4a::device::get_installed_count();
if

本文介绍了如何通过PCL库结合Azure Kinect SDK,实时显示并保存从设备采集到的彩色点云数据。代码示例展示了从设备获取图像,转换为PCL格式,并使用PCL可视化工具进行显示,同时监听键盘输入实现点云的保存和程序退出。
最低0.47元/天 解锁文章
3469

被折叠的 条评论
为什么被折叠?



