给定深度下由单个Kinect像素表示的空间 [英] Space represented by a single Kinect pixel at a given depth

查看:101
本文介绍了给定深度下由单个Kinect像素表示的空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我想在设备的视点上采取一条固定的直线,并确定是否有任何物体拦截到该直线,但是在我的示例中,我想使激光线"相对于距视场顶部的距离可配置视图.

Basically I want to take a fixed straight line across the devices point of view and determine if anything intercepts it but in my example I want to make the "laser line" configurable with regards to the distance from the top of the field of view.

现在,只需执行此操作即可轻松获得给定像素点的深度数据.

Now it's easy enough to get the depth data at a given pixel point simply by doing this.

var depthInMM = DepthImagePixel.Depth;

并且也很容易简单地说,我想通过做这样的事情来关注从顶部开始的第100行像素.

and its also easy to simply say I want to focus on the 100th line of pixels from the top by doing something like this.

for (int i = 0; i < this._DepthPixels.Length; ++i) //_DepthPixels.Length is obviously 307200 for 640x480
{
    if (i >= 64000 && i <= 64640) //Hundredth vertical pixel line
    {
        //Draw line or whatever
    }
}

最终会出现这样的情况.

Which ends up with something like this.

例如,但我可能想让线在距3米深度的视场顶部50厘米处截取.现在显然我知道随着深度的增加,所表示的面积也会增加,但是我找不到任何参考,或者我自己也想出如何计算这种关系的方法.

BUT for example I might want to have the line intercept at 50 cm from the top of the field of view at 3 meters depth. Now obviously I understand that as the depth increases so does the area represented but I cannot find any reference or myself work out how to calculate this relationship.

因此,如何利用Kinect传感器计算在给定深度处表示的坐标空间.衷心感谢您的帮助.

So, how can one calculate the coordinate space represented at a given depth utilizing the Kinect sensor. Any help sincerely appreciated.

因此,如果我理解正确,则可以在C#中实现

So if I understand correctly this can be implemented as such in C#

double d = 2; //2 meters depth
double y = 100; //100 pixels from top
double vres = 480; //480 pixels vertical resolution
double vfov = 43; //43 degrees vertical field of view of Kinect
double x = (2 * Math.Sin(Math.PI * vfov / 360) * d * y) / vres;
//x = 0.30541768893691434
//x = 100 pixels down is 30.5 cm from top field of view at 2 meters depth

推荐答案

     2 sin(PI VFOV / 360) D Y
X = --------------------------
              VRES

X :您的线到图像顶部的距离(以米为单位)

X: distance of your line from the top of the image in meters

D :距相机线的距离-与图像平面正交-以米为单位

D: distance - orthogonal to the image plane - of your line from the camera in meters

Y :行距图像顶部的距离(以像素为单位)

Y: distance of your line from the top of the image in pixels

VRES :图像的垂直分辨率(以像素为单位)

VRES: vertical resolution of the image in pixels

VFOV :摄像机的垂直视场,以度为单位

VFOV: vertical field of view of the camera in degrees

这篇关于给定深度下由单个Kinect像素表示的空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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