远离深度的问题 [英] problems getting distance from depth

查看:88
本文介绍了远离深度的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿所有人,b $ b $
i试图创建一个程序来检测某个物体与kinect相关的距离。

I通过在显示摄像机图像的窗口中单击它来获取对象。但每次我只有


获得几米的距离,我不知道问题出在哪里。也许你可以帮助我?

我只使用深度数据,我选择的语言是c#。为了练习,我使用了"Microsoft Kinect SDK入门"。由迈克詹姆斯和"Kinect for Windows SDK快速启动"作者:Dan Fernandez在channel9上。

为了得到距离,我写了以下方法:



public int getDistance(int mouseX,int mouseY)

        {

            int距离;

       

        //获取职位

           十进制picX = picBoxD.Width;

           十进制picY = picBoxD.Height;
$


           十进制orgX = picBoxD.Image.Width;

           小数ORGY = picBoxD.Image.Height;



           小数convMouseX = Convert.ToDecimal(mouseX);

           十进制convMouseY = Convert.ToDecimal(mouseY);

           十进制ergX =(convMouseX / picX)* orgX;

           小数ergY =(convMouseY / picY)* orgY;

            int orgMouseX = Convert.ToInt32(ergX);

            int orgMouseY = Convert.ToInt32(ergY);

           

            

         //获取距离



            INT指数=(orgMouseX * pImageD.BytesPerPixel + orgMouseY * pImageD.Width * pImageD.BytesPerPixel);



      &NBSP ;     distance = pImageD.Bits [index + 1];

           距离<<< =< =<< =< =&n;           距离+ = pImageD.Bits [指数];

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;


           返回距离;

        } b


在此先感谢您的帮助。

Hey everybody,

i tried to create a programm which detects the distance of a certain object as related to the kinect.
I get the object by clicking on it in the window displaying the camera image. But everytime i only
get distances over several meters and i don't know where the problem could be. Maybe you could help me?
I only use depth-data and the language i chose is c#. For practicing i worked with the "Getting started with Microsoft Kinect SDK" by mike James and the "Kinect for Windows SDK Quickstarts" by Dan Fernandez on channel9.
For getting the distance i wrote the following method:

public int getDistance(int mouseX, int mouseY)
        {
            int distance;
       
        //get position
            Decimal picX = picBoxD.Width;
            Decimal picY = picBoxD.Height;

            Decimal orgX = picBoxD.Image.Width;
            Decimal orgY = picBoxD.Image.Height;

            Decimal convMouseX = Convert.ToDecimal(mouseX);
            Decimal convMouseY = Convert.ToDecimal(mouseY);
            Decimal ergX = (convMouseX/picX)*orgX;
            Decimal ergY = (convMouseY/picY)*orgY;
            int orgMouseX = Convert.ToInt32(ergX);
            int orgMouseY = Convert.ToInt32(ergY);
           
            
         // get distance

            int index = (orgMouseX * pImageD.BytesPerPixel + orgMouseY * pImageD.Width * pImageD.BytesPerPixel);

            distance = pImageD.Bits[index + 1];
            distance <<= 8;
            distance += pImageD.Bits[index];
                       
            return distance;
        }

Thanks in advance for your help.

推荐答案

没有问题,传感器只有几米的范围。
There is no problem, The sensor only has a range of a several meters.


这篇关于远离深度的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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