主要内容

绘制来自Kinect for Windows的彩色点云

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

运行此示例的要求

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

2.Kinect for Windows v2传感器。

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

为Kinect v2设备创建系统对象

colorDevice = imaq。VideoDevice (“kinect”,1) depthDevice = imaq。VideoDevice (“kinect”, 2)
colorDevice = imaq。VideoDevice with properties: Device: 'Kinect Color Sensor (Kinect -1)' VideoFormat: 'RGB_640x480' ROI:[1 1 640 480]海归着色空间:'rgb'海归数据类型:'uint8' DeviceProperties: [1x1 imaq.internal.DeviceProperties] depthDevice = imaq。VideoDevice with properties: Device: 'Kinect Depth Sensor (Kinect -2)' VideoFormat: 'Depth_640x480' ROI:[1 1 640 480]海归着色空间:'灰度'海归数据类型:'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中的点云。player = pcplayer(ptCloud. exe)XLimits ptCloud。YLimits ptCloud。ZLimits,...“VerticalAxis”“y”“VerticalAxisDir”“下来”);包含(球员。轴,“X (m)”);ylabel(球员。轴,“Y (m)”);zlabel(球员。轴,“Z (m)”);获取和查看Kinect点云数据。isOpen(player) colorImage = colorDevice();depthImage = depthDevice();ptCloud = pcfromkinect(depthDevice, depthImage, colorImage);视图(球员,ptCloud);结束

释放设备

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

更多关于Kinect Point Clouds的信息

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

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

-由于Kinect是为游戏而设计的,来自Kinect的原始图像colorImage和depthImage是场景的镜像。返回的点云被校正以匹配实际场景。