我正在做一个 kinect 项目..我试图找到偏移量(关节坐标之间的差异)并使用 TCP/IP 通过网络发送它..但是,我面临访问以前值的问题联合..这些是我到目前为止的代码:
Joint right = skel.Joints[JointType.HandRight];
double right = right.Position.X;
/*
I need an operation here to calculate the offset of right before sending it
Meaning, offset= right(current coordinate)-right(previous coordinate)
How can I do this in C# ?
I have tried this operation as mentioned below but it is printing all zeros although I moved (if move, previous - current coordinates shall not be zero)
*/
//---------------------------------------------------------------------------
double offset = 0;
double[] of = new double[2];
for (int i = 0; i < of.Length; i++)
{
if (i > 2)
{
break;
}
of[i] = right;
offset = of[1] - of[0];
}
//---------------------------------------------------------------------------
//convert the data to bytes before sending
byte[] rh = BitConverter.GetBytes(offset);
//sending the data to the server
client.Send(rh, rh.Length);