本周文件交换精选

我们最好的用户提交

硬件支持Kinec万博1manbetxt v2图像采集

内容

阿维本周的选择是一个硬件支持包万博1manbetxwindowsruntime Kinect图像采集工万博1manbetx具箱支持包,通过图像采集工具箱团队.硬件支持包使您能够从Kin万博1manbetxect v2传感器获取RGB、深度图像和3-D点云。如果你有Windows v2版本的Kinect,你可以通过从File Exchange下载硬件支持包开始在MATLAB中使用它。万博1manbetx

在MATLAB中使用Kinect for Windows v2

成功安装硬件支持包后,可以通过定义imaq连接到设备。万博1manbetxVideoDevice系统对象。记住Kinect v2同时返回RGB和深度图像,所以我们为它们创建一个系统对象
colorDevice = imaq。VideoDevice (“kinect”,1) depthDevice = imaq。VideoDevice (“kinect”,2)
colorDevice = imaq。视频Device with properties: Device: 'Kinect V2 Color Sensor (kinect-1)' VideoFormat: 'BGR_1920x1080' ROI: [1 1 1920 1080] ReturnedColorSpace: 'rgb' ReturnedDataType: 'uint8' DeviceProperties: [1x1 imaq.internal.DeviceProperties] depthDevice = imaq.VideoDevice with properties: Device: 'Kinect V2 Depth Sensor (kinect-2)' VideoFormat: 'Depth_512x424' ROI: [1 1 512 424] ReturnedColorSpace: 'grayscale' ReturnedDataType: 'uint16' DeviceProperties: [1x1 imaq.internal.DeviceProperties]

初始化设备

现在让我们初始化设备并获取一个输入RGB图像和一个深度图像。
步骤(colorDevice);初始化颜色/RGB传感器步骤(depthDevice);初始化深度传感器colorImage = step(colorDevice);加载一个颜色/RGB帧depthImage = step(depthDevice);加载一个深度帧

从设备上获取3d点云

由于传感器同时具有颜色和深度信息,您可以结合这两个传感器的信息来创建一个3-D点云。
ptCloud = pcfromkinect(depthDevice,depthImage,colorImage);

在Kinect v2上观看点云流

让我们初始化pcplayer,它将让我们可视化3d点云的实时流。我们首先初始化播放器。
播放器= pcplayer(ptCloud.XLimits,ptCloud.YLimits,ptCloud.ZLimits,...“VerticalAxis”“y”“VerticalAxisDir”“下来”);包含(球员。轴,“X (m)”);ylabel(球员。轴,“Y (m)”);zlabel(球员。轴,“Z (m)”);然后从Kinect v2中实时播放3d点云。。i = 1:500 colorImage = step(colorDevice);depthImage = step(depthDevice);ptCloud = pcfromkinect(depthDevice,depthImage,colorImage);视图(球员,ptCloud);结束Kinect_POTW_Post_01

在三维点云中检测平面

一旦我们从Kinect v2中获得了3d点云,我们就可以使用计算机视觉系统工具箱中的功能来处理它。在这里,我简单地在3-D点云中提取和显示平面。
colorImage = step(colorDevice);depthImage = step(depthDevice);ptCloud = pcfromkinect(depthDevice,depthImage,colorImage);获取一个新的点云maxDistance = 0.02;referenceVector = [0,0,1];maxAngularDistance = 5;[model,inlierIndices,outlierIndices] = pcfitplane(ptCloud,maxDistance,referenceVector,maxAngularDistance);图;pcshow (ptCloud);持有;情节(模型)Kinect_POTW_Post_02

释放设备

当你们都没有的时候,别忘了释放设备。
释放(colorDevice);释放(depthDevice);
|
  • 打印
  • 发送电子邮件

评论

如欲留言,请点击在这里登录到您的MathWorks帐户或创建一个新帐户。