主要内容

绘制Windows Kinect的彩色点云

这个例子展示了如何使用Windows v2的Kinect绘制彩色点云。

运行此示例的要求

1.MATLAB,图像采集工具箱和计算机视觉系统工具箱。

2.用于Windows v2的Kinect传感器。

3.PC最低配置:Windows 8 64位。

为Kinect v2设备创建系统对象

colorDevice = imaq。VideoDevice (“kinect”,1) depthDevice = imaq。VideoDevice (“kinect”, 2)
colorDevice = imaq。设备:'Kinect Color Sensor (Kinect -1)' VideoFormat: 'RGB_640x480' ROI: [1 1 640 480] recurdcolorspace: 'rgb' recurddatatype: 'uint8' DeviceProperties: [1x1 imaq.internal.DeviceProperties] depthDevice = imaq. depthDevice。【1 1 640 480】recurdcolorspace:‘grayscale’recurddatatype:‘uint16’DeviceProperties: [1x1 imq .internal.DeviceProperties]

初始化摄像头

colorDevice ();depthDevice ();

从设备上抓取一帧

colorImage = colorDevice ();depthImage = depthDevice ();

提取点云

depthDevice必须是Kinect深度视频输入对象或Kinect深度imaq。VideoDevice对象。

depthImage必须是uint16。colorImage必须是uint8。

ptCloud = pcfromkinect(depthDevice, depthImage, colorImage);初始化一个播放器来可视化3-D点云数据。。轴是%设置以可视化来自Kinect的点云。球员= pcplayer (ptCloud。XLimits ptCloud。YLimits ptCloud。ZLimits,...“VerticalAxis”“y”“VerticalAxisDir”“下来”);包含(球员。轴,“X (m)”);ylabel(球员。轴,“Y (m)”);zlabel(球员。轴,“Z (m)”);获取并查看Kinect点云数据。。isOpen(播放器)colorImage = colorDevice();depthImage = depthDevice ();ptCloud = pcfromkinect(depthDevice, depthImage, colorImage);视图(球员,ptCloud);结束

释放设备

释放(colorDevice);释放(depthDevice);

更多关于Kinect点云的信息

-右手坐标系的原点在相机的中心。坐标系的X轴是指向右边的,Y轴是向下的,Z轴是指向远离相机的。

-由于Kinect深度摄像头的范围有限,深度图像中的一些像素没有相应的3d坐标。在ptCloud的Location属性中,这些像素的值被设置为NaN。

-由于Kinect是为游戏设计的,来自Kinect的原始图像colorImage和depthImage是场景的镜像。对返回的点云进行校正,使其符合实际场景。

Baidu
map