如何将关节的坐标保存到多维数组中 [英] How to save joint's coordinates into multidimensional array

查看:96
本文介绍了如何将关节的坐标保存到多维数组中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好, 


我有一个看似愚蠢的问题,但我从昨天开始就陷入其中!


我正在使用ms kinect sdk 1.7开发一个小应用程序,当检测骨架并跟踪所有关节时,我想将其保存到(20,3)的多维数组中,它们分别是人体关节的数量和沿着$的坐标。 b $ b 3轴。 


我的目标是在3轴之后计算最大值和最小值..所以我从这段代码开始。

 private static double [] [] JointTab = new double [20] [3]; 

double save_joints(Skeleton first)
{


foreach(联合j in first.Joints)
{

for(int li = 0; li< 20; li ++)
{
JointTab [li] [0] = j.Position.X;
JointTab [li] [1] = j.Position.Y;
JointTab [li] [2] = j.Position.Z;
}

}
返回JointTab;
}

它表示该方法没有返回必要的值?我怎么能修复这个错误? 


我需要调用JointTab之后如何用Array.Sort()方法对每个colomn进行排序 ?


感谢您的帮助! 




DKF

解决方案

您遇到的问题并非特定于Kinect SDK。您将需要查看数组的托管代码构造,因为它无效。有一些方法可以创建一个结构的单个数组,然后您可以提供自己的枚举。
你可能想查看.Net的泛型集合,看看最好的是什么,因为你可以提供一些逻辑,因为空间中的点需要计算长度。


Hello everyone, 

i have a question that's seems silly but i'm stuck in it since yesterday !

i'm developping a small application with ms kinect sdk 1.7 and when detecting skeleton and all joints are tracked i want to save it into multidimensional array of (20,3) which are respectively the number of joints in human body and the coordinates along the 3 axes. 

my goal is to calculate after that the max and the min values throught the 3 axes.. so i began with this piece of code.

   private static double[][] JointTab = new double [20][3];
   
   double  save_joints(Skeleton first)
        {


            foreach (Joint j in first.Joints)
            {

                for (int li = 0; li < 20; li++)
                {
                    JointTab[li][0] = j.Position.X;
                    JointTab[li][1] = j.Position.Y;
                    JointTab[li][2] = j.Position.Z;
                }

            }
return JointTab; 
        }

it indicates that the method does not return a value necessary ? how could i fix this error ? 

i will need to call the JointTab after that how can i sort each colomn with Array.Sort() method  ?

thanks for any help ! 


DKF

解决方案

The issue you are having is not specific to the Kinect SDK. You will need to look into your managed code construction of the array since that is not valid. There are ways to create a single array of a structure which you can then provide your own enumeration. You may want to look at the generic collections of .Net to see what would be best since you will way to provide some logic to the sort since the points in space will need to calculate a length.


这篇关于如何将关节的坐标保存到多维数组中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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