来自Kinect中指定的X,Y值的Z坐标值 [英] Z coordinate value from specified X,Y values in Kinect

查看:198
本文介绍了来自Kinect中指定的X,Y值的Z坐标值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我试图获得深度帧上指定的X,Y值的Z坐标值(深度)/(即使是彩色帧,如果是可能)在用于Kinect的microsoft SDK中。我的最终目标是检测彩色物体并在屏幕上跟踪该物体的深度值。现在我所拥有的是一种算法,用于跟踪屏幕上的彩色对象,并使用AForge.net库动态地从320x240图像返回(x,y)坐标值。对我来说,下一步是使用这个x,y值并在深度流的帮助下获得z位置。我正在使用C#来实现此功能。关于我将如何做的任何指示或链接到那些做过类似事情的人都会非常感激。仅供参考,图像上可能没有任何人体骨架,因此骨架关节跟踪不是我想要的。



来自KinectStudio(记录所有Kinect数据的程序) ,如果我打开View> Depth,我会得到图像,如 https://dl.dropboxusercontent.com /u/49447650/depth.png X,Y和Depth值将显示在鼠标指向图像底部的位置。这与我想要的非常相似,但是在颜色框架上。

Hi,

I am trying to get the Z coordinate value(depth) for a specified X,Y values on a depthframe/ (even color frame if that''s possible) in microsoft SDK for Kinect. My ultimate aim is to detect a coloured object and track the depth value of that object on the screen. Right now what I have is an algorithm to track the coloured object on screen and give back the (x,y) coordinate value from the 320x240 image dynamically using AForge.net library. Next step for me is to use this x,y values and get the z-position with the help of the depth stream. I am using C# to achieve this functionality. Any pointers on how would i do it or links to those who have done similar thing would be much appreciated. FYI, there may not be any human skeleton on the image so skeleton joint tracking is not what I want.

From KinectStudio (the program to record all the Kinect data), if I turn on the View>Depth, I get the image as shown in https://dl.dropboxusercontent.com/u/49447650/depth.png The X,Y and Depth values will be shown where the mouse is pointed at in this at the bottom of the image. This is very similar to what I want as well, but on a colour frame.

推荐答案

你可以做一个矩阵数组(注意矩阵必须是一个结构,其中你节省了R,G,B)



它看起来像这样:



You can do a an Array of Matrixes (NOTE Matrix must be a structure where you save R, G, B)

it will look something like this:

//set them how you wish
int MaxX = 30;
int MaxZ = 30;
int MaxY = 30;

public struct ColorM
{
    int R;
    int G;
    int B;
}

ColorM[,,] Area = new ColorM[MaxZ,MaxY,MaxX];

void Main(string[] args)
{
     Program p = new Program(); 
     for(int z = 0; z < 30; z+)
     {
          for(int y = 0; y < 30; y++)
          {
                for(int y = 0; y < 30; y++)
                {
                    //p.Area[z,y,z]                     
                    
                }
          }   
     }
}


我找到了基本方法。感谢:http://www.i-programmer.info/ebooks/practical-windows-kinect-in-c/3802-using-the-kinect-depth-sensor.html



颜色框架可能不太准确,但现在我很高兴!



I figured out the basic method. thanks to: http://www.i-programmer.info/ebooks/practical-windows-kinect-in-c/3802-using-the-kinect-depth-sensor.html

May be not very accurate in colour frame, but for now I am happy!

using (DepthImageFrame dframe = _sensor.DepthStream.OpenNextFrame(0)) 
            {
                if (dframe != null) 
                {
                    short[] pixeldata = new short[dframe.PixelDataLength];
                    dframe.CopyPixelDataTo(pixeldata);
                    int x = **//specify x value here
                    int y = **//specify y value here
                    int d = (ushort)pixeldata[x + y * dframe.Width];
                    d = d >> 3;//this is distance in mm
                } 
            } 


这篇关于来自Kinect中指定的X,Y值的Z坐标值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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