HandList hands = frame.Hands;
Hand h = hands[0];
Vector pp = h.PalmPosition;
sw.WriteLine(String.Format("{0:f4}, {0:f4}, {0:f4}", pp.x, pp.y, pp.z));

For this code, my output for x, y, and z are always the same. If I move in a circle around the loop, the x,y,z coordinates are always the same, which is not desirable.

How do I obtain the x,y,z coordinates for a Palm?

有帮助吗?

解决方案

You seem to be printing out pp.x 3 times, never using the other 2 variables, because the zero in {0:f4} specifies the first parameter after the format string itself -- pp.x.

string h = "Hello";
string w = "World!";

Console.WriteLine("{0} {1}, it is {2}.", h, w, DateTime.Now);

This silly example should make it more clear. Also notice that this overload of Console.WriteLine formats text just like string.Format. More info here.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top