情节彩色点云从Kinect为Windows V2
这个例子展示了如何使用Kinect情节彩色点云®Windows®V2。
需求
MATLAB®、图像采集工具箱™和计算机视觉的工具箱™
Kinect为Windows V2传感器
电脑最低配置:Windows 64位
为V2 Kinect设备创建系统对象
Kinect摄像头将传感器颜色和深度。创建单独的传感器和深度传感器系统对象的颜色。
colorDevice = imaq.VideoDevice (“kinect”,1)
colorDevice = imaq。VideoDevice属性:设备:“Kinect V2色彩传感器(kinect-1) VideoFormat:“BGR_1920x1080”ROI: [1 1 1920 1080] ReturnedColorSpace:“rgb”ReturnedDataType:“uint8”ReadAllFrames:‘off’DeviceProperties: [1×1 imaq.internal.DeviceProperties]
depthDevice = imaq.VideoDevice (“kinect”,2)
depthDevice = imaq。VideoDevice属性:设备:“Kinect V2深度传感器(kinect-2) VideoFormat:“Depth_512x424”ROI: [1 1 512 424] ReturnedColorSpace:“灰度”ReturnedDataType:“uint16”ReadAllFrames:‘off’DeviceProperties: [1×1 imaq.internal.DeviceProperties]
初始化传感器。
colorDevice ();depthDevice ();
从每个传感器获取一帧。
colorImage = colorDevice ();depthImage = depthDevice ();
提取点云
depthDevice
必须是一个Kinect深度videoinput
对象或一个Kinect的深度imaq.VideoDevice
对象。
depthimage
必须uint16
和colorImage
必须uint8
。
ptCloud = pcfromkinect (depthDevice depthImage colorImage);
初始化一个球员可视化三维点云数据。轴设置适当的可视化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(球员)colorImage = colorDevice ();depthImage = depthDevice ();ptCloud = pcfromkinect (depthDevice depthImage colorImage);视图(球员,ptCloud);结束
当你完成关闭的球员。
释放设备
释放(colorDevice);释放(depthDevice);
更多关于Kinect点云
一个右撇子的世界坐标系统的起源是在相机的中心。坐标系的X轴指向右边,Y轴是下行,Z轴指向远离相机。
自从Kinect深度相机范围有限,一些像素深度图像没有对应的三维坐标。这些像素的值设置为南ptCloud位置属性。
Kinect是为游戏设计以来,原始图像,colorImage depthImage, Kinect是镜像的场景。返回的点云修正以匹配实际的场景。