Kinect の位置を記録するときに、ストップウォッチの開始と停止を試みています。
//process x and y coordinates
public void calculateJoints(Skeleton skeleton)
{
Joint rightHand = skeleton.Joints[JointType.HandRight];
Joint leftHand = skeleton.Joints[JointType.HandRight];
rightX = rightHand.Position.X;
rightY = rightHand.Position.Y;
}
//start the stopwatch (tried to use a greater time between positions 1 and 5 vs 1 and 2
public void processJointsAndRepeat(Skeleton skeleton)
{
startTime();
while (numPositions < 5)
{
calculateJoints(skeleton);
numPositions++;
}
stopTime();
double tempTime = calculateTimeElapsed();
}
//calculate time in milliseconds
private double calculateTimeElapsed()
{
long milliseconds = stopWatch.ElapsedMilliseconds;
return (double)milliseconds;
}
しかし、時間をキーとして x、y、および時間の値を入力しようとすると、キーが重複しているというエラーがスローされます。tempTime の値を取得すると、0 しか表示されませんでした。
これは私のコードの問題ですか、それとももっと正確なストップウォッチが必要ですか?
30 fps の時間を確保するのは難しいと認識しているので、他に提案があれば、それは素晴らしいことです! 私は基本的に、ポイント間の平均速度を計算して、オーディオ ファイルの再生速度を調整しようとしています。ありがとう!