#include <iostream>
#include <string>
#include <sstream>
#include <opencv2/opencv.hpp>
#include <sys/time.h>
#include <unistd.h>
#include <fstream>
#include <libfreenect2/libfreenect2.hpp>
#include <libfreenect2/frame_listener_impl.h>
#include <libfreenect2/registration.h>
#include <libfreenect2/packet_pipeline.h>
#include <libfreenect2/config.h>
using namespace std;
using namespace cv;
libfreenect2::Freenect2 freenect2;
libfreenect2::Freenect2Device *device = nullptr; //传感器设备
libfreenect2::PacketPipeline *pipeline = nullptr; //数据传输方式
libfreenect2::SyncMultiFrameListener* listeners ; //同步多窗口监听器
libfreenect2::Registration *reg;
enum Processors { _CPU = 1, _CUDA, _OpenGL} ;
Processors processor = _CPU;
enum ImgTypes{ _rgb=1,_depth,_undistort} ;
struct IntrinsicMatrix
{
float fx;
float fy;
float cx;
float cy;
} ColorIntrinsic, DepthIntrinsic;
struct Distortion
{
float k1;
float k2;
float p1;
float p2;
float k3;
} distortion;
struct timeval tv;
bool shutdown = false;
/**
*@param :
** processor: the processor which you want to use as packet pipeline
*@Description:initial and open the device of kinect,and set the Processor
* to traismit the data from kinect.
*/
bool InitSensor(const Processors processor)
{
///scan the sensor
if(freenect2.enumerateDevices() == 0)
{
throw " [Info] [Initial Erro]: No device connected.";
利用libfreenect2获取Kinect 2 彩色和深度图像以及相机参数
最新推荐文章于 2024-09-06 23:21:36 发布
本文详细介绍了如何使用libfreenect2库从Kinect 2设备中获取彩色和深度图像,同时涵盖了提取相机参数的步骤,为深度感知和三维重建提供基础。

最低0.47元/天 解锁文章
1123

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



