Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
KinectSdk V2, be sure of lifecycle of objects
static void _bodyFrameReader_FrameArrived(object sender, BodyFrameArrivedEventArgs e)
{
var frame = e.FrameReference.AcquireFrame();
if (null == frame) return;
using (frame)
{
frame.GetAndRefreshBodyData(_bodies);
foreach (var body in _bodies)
{
if (null != body && body.IsTracked)
{
var msg = "Left:" + body.HandLeftState + " Right:" + body.HandRightState;
Console.WriteLine(msg);
}
}
}
}
static void _bodyFrameReader_FrameArrived(object sender, BodyFrameArrivedEventArgs e)
{
var frame = e.FrameReference.AcquireFrame();
if (null == frame) return;
frame.GetAndRefreshBodyData(_bodies);
foreach (var body in _bodies)
{
if (null != body && body.IsTracked)
{
var msg = "Left:" + body.HandLeftState + " Right:" + body.HandRightState;
Console.WriteLine(msg);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.