如何使用Matlab或C#在Kinect V2中将颜色流(1920x1080)转换为深度流(512x424) [英] How can I convert color stream (1920x1080) into depth stream(512x424) in Kinect V2 using matlab or C#
问题描述
Kinect V2颜色流支持的格式为:1920x1080.但kinect V2深度流格式为:512x424.现在,当我为两个传感器启动实时蒸汽时,由于分辨率不同,它们的尺寸也有所不同.我无法调整它们的大小,因为我需要坐标.所以当我使用Imresize()调整大小时,坐标不匹配.我已经读过matlab文档,他们说硬件仅分别支持这两种格式,现在我该如何在代码中做到这两个流具有相同的分辨率.我尝试了两天,但失败了.此外,我想通过任何方法进行操作,以便拍摄第一张深度图像,并基于此深度分辨率拍摄RGB或彩色图像.
Kinect V2 color stream supported format is : 1920x1080. But kinect V2 depth stream format is : 512x424. Now when I start live steam for both sensors then they have different sizes because of different resolution. I cant resize them, because I need coordinates . so when I resize using Imresize(),the coordinates are not matched. I already read matlab documentation.They said hardware only supports this two format respectively.Now How can i do this in code so that both stream have the same resolution. I tried two days long but failed.Moreover, I want to do it by any process so that i take first depth image and based on this depth resolution it will take RGB or color image.
我的项目是从深度图像中提取线条并将其映射到kinect v2的RGB图像上.但是那里的分辨率不一样.因此[x,y]坐标发生了变化.因此,当我将其映射到RGB时,它与深度图像的坐标不匹配.我该如何解决?我以为我会更改分辨率,但是在kinect V2中,布局无法更改.现在我该如何在编码中做到这一点.
My project is I take the line from depth image and map them on RGB image of kinect v2. but there resolution are not same. so [x,y] cordinates changed. so when I map it on RGB it not matched with the coordintes of depth image. how can i solve it ?. I thought i will change the resolution but in kinect V2 resoution cant change.Now how can i do it in coding.
推荐答案
对于工作示例,您可以检查 VRInteraction .我将深度图像映射到RGB图像以建立3D点云.
For working example, you can check VRInteraction. I map depth image to RGB image to build up 3D point cloud.
您想要实现的目标称为注册.
What you want to achieved is called Registration.
- 校准深度相机以找到深度相机投影矩阵(使用opencv)
-
校准RGB摄像机以找到RGB摄像机投影矩阵(使用opencv)
- Calibrate Depth camera to find the Depth camera projection matrix (Using opencv)
Calibrate RGB camera to find the RGB camera projection matrix (Using opencv)
-您可以将深度图像注册为RGB图像:
正在映射给定深度图像的相应RGB像素.最终将获得1920x1080 RGB深度图像的分辨率.由于深度像素较少,因此并非所有RGB像素都具有深度值.为此,您需要
Which is mapping the corresponding RGB pixel of the given Depth image. This will end up with a resolution of 1920x1080 RGB-Depth image. Not all the RGB pixels will have a depth value since there are less depth pixels. For this you need to
- 使用深度相机投影矩阵计算每个深度像素的真实世界ordinates()
- 计算预先计算出的真实世界坐标的RGB像素的坐标
-
使用先前计算出的RGB像素坐标找到RGB图像中的匹配像素
- calculate real world ordinates() of each depth pixel using Depth camera projection matrix
- calculate the coordinates of the RGB pixel of that previosly calculated real world ordinates
Find the matching pixel in the RGB image using previously calculated coordinates of the RGB pixel
-您可以将RGB图像图像注册到深度图像:
正在映射给定RGB图像的相应深度像素.最终将获得512x424 RGB深度图像的分辨率.为此,您需要
Which is mapping the corresponding Depth pixel of the given RGB image. This will end up with a resolution of 512x424 RGB-Depth image. For this you need to
- 使用深度相机投影矩阵计算每个RGB像素的现实世界ordinates()
- 计算先前计算的真实世界坐标的深度像素的坐标
- 使用先前计算的RGB像素坐标在深度图像中找到匹配的像素
如果要实时实现这一目标,则需要考虑使用GPU加速.特别是如果您的深度"图像包含超过30000个深度点.
If you want to achieved this in real-time, you will need to consider about using GPU accelerating. Specially if your Depth image contains more than 30000 depth points.
我在这件事上写了硕士论文.如果您还有其他问题,我们很乐意为您提供帮助.
I wrote my masters theses on this matter. if you have more questions, I'm more than happy to help you.
这篇关于如何使用Matlab或C#在Kinect V2中将颜色流(1920x1080)转换为深度流(512x424)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!