这个例子展示了如何在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深度传感器(Kinect -2)' VideoFormat: 'Depth_640x480' ROI: [1 1 640 480] ReturnedColorSpace: 'grayscale' ReturnedDataType: 'uint16' DeviceProperties: [1x1 imaq.internal.DeviceProperties]
colorDevice ();depthDevice ();
colorImage = colorDevice ();depthImage = depthDevice ();
深度设备必须是Kinect depth视频输入对象或Kinect depth imaq。VideoDevice对象。
深度成像必须达到16。彩色图像必须是有效的。
ptCloud = pcfromkinect(depthDevice, depthImage, colorImage);初始化播放器以可视化3-D点云数据。轴是%适当地设置为从Kinect可视化点云。球员= pcplayer (ptCloud。XLimits ptCloud。YLimits ptCloud.ZLimits,…“VerticalAxis”,“y”,“VerticalAxisDir”,“下来”);包含(player.Axes“X (m)”);ylabel (player.Axes“Y (m)”);zlabel (player.Axes“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的原始图像,彩色图像和深度图像都是场景的镜像。返回的点云被修正以匹配实际场景。