Kinect SDK在“颜色"位置获取深度 [英] Get Depth at Color position, Kinect SDK

查看:104
本文介绍了Kinect SDK在“颜色"位置获取深度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法(尽可能快)从Kinect相机获得与彩色像素对应的深度.

I am looking for way to (as quick as possible) get the corresponding depth to a color pixel from the Kinect camera.

我发现了MapDepthFrameToColorFrame函数.但这只是给我一定深度的颜色,我要相反.

I have found the MapDepthFrameToColorFrame function. But that only gives me the color at a certain depth position, I want the opposite.

我想要这样做的原因是,我将能够在RGB图像上单击一个位置,并将该位置移至该像素.

The reason I want this is that I will be able to click on a position at the RGB image and get the position to that pixel.

有没有比遍历MapDepthFrameToColorFrame中的所有结果更快的方法了?

Is there a way to do this faster than looping through all results from MapDepthFrameToColorFrame?

推荐答案

此处的问题是,由于相机和红外发射器的放置方式,并非每个彩色像素都会分配一个深度.如果您面对Kinect并用左手举起您的胸部,则您胸部的一部分区域没有深度数据,因为您的手挡住了IR发射器.由于红外摄像头更接近RGB摄像头,因此从深度到RGB通常不会遇到相同的问题;如果Kinect可以看到IR,则可以看到RGB.

The problem here is that not every color pixel will have a depth assigned to it because of the way the cameras and IR emitter are positioned. If you're facing the Kinect and holding up your left hand in front of your chest, there's a section of your chest that won't have depth data because your hand blocks the IR emitter. Since the IR camera is closer to the RGB camera, you generally won't have the same problem going from depth to RGB; if the Kinect can see the IR, it can see the RGB.

要回答您的问题:我不知道有任何方法可以执行此操作,因为RGB索引不能为您提供足够的信息来计算深度索引.您是否尝试过使用MapDepthFrameToColorFrame并像您提到的那样进行循环?除非您像疯子(或计算机)一样单击,否则我敢打赌,该应用程序将能够很好地处理此问题.在您确定它会引起问题之前,我不会花时间尝试对其进行优化.

To answer your question: I'm not aware of any way to do this because the RGB index doesn't give you enough information to calculate the depth index. Have you tried using the MapDepthFrameToColorFrame and looping like you mentioned? Unless you're clicking like a maniac (or a computer), I'd be willing to bet that the application will be able to handle this just fine. I wouldn't spend time trying to optimize this until you're sure it's causing a problem.

如果需要,您可以尝试通过检查函数返回的颜色坐标的子集来减小循环的大小.获取RGB像素(x,y)的坐标,然后检查接近(x,y)的深度坐标.可能是(x-20,y-20)到(x + 20,y + 20).如果找不到它,则可以检查阵列的其余部分.稍微测试一下,您可能可以找到一个合适的范围来检查所请求的像素,在大多数情况下您都会获得成功,而不会产生很多循环.

If you want to, you could try cutting down on the size of the loop by checking a subset of the color coordinates returned by the function. Get the coordinates of the RGB pixel (x, y), then check the depth coordinates somewhere close to (x,y). Perhaps (x-20, y-20) to (x+20, y+20). If that fails to find it, you can check the rest of the array. Test this out a bit and you can probably find a good range to check around the requested pixel that you'll get a hit the majority of the time, without a lot of looping.

这篇关于Kinect SDK在“颜色"位置获取深度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆