这个例子展示了如何使用Windows v2的Kinect绘制颜色点云。
1.MATLAB,图像采集工具箱和计算机视觉系统工具箱。
2.用于Windows v2传感器的Kinect。
3.PC机最低配置:Windows 8 64位。
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] ReturnedColorSpace: 'rgb' ReturnedDataType: '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] ReturnedColorSpace: 'grayscale' ReturnedDataType: 'uint16' DeviceProperties: [1x1 imac .internal.DeviceProperties]
colorDevice ();depthDevice ();
colorImage = colorDevice ();depthImage = depthDevice ();
depthDevice必须是Kinect深度视频输入对象或Kinect深度imaq。VideoDevice对象。
depthImage必须是uint16。colorImage必须是uint8。
ptCloud = pcfromkinect(depthDevice, depthImage, colorImage);初始化播放器以可视化三维点云数据。轴是%设置适当以可视化Kinect的点云。球员= pcplayer (ptCloud。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);
-右撇子世界坐标系的原点在相机的中心。坐标系统的X轴向右,Y轴向下,Z轴远离摄像机。
-由于Kinect深度相机的范围有限,深度图像中的一些像素没有相应的三维坐标。这些像素的值在ptCloud的Location属性中设置为NaN。
-因为Kinect是为游戏设计的,所以来自Kinect的原始图像,colorImage和depthImage都是场景的镜像。返回的点云被校正以匹配实际场景。